View Full Version : results of recordset in message box???
parallon
07-24-2006, 08:15 PM
Hello all. I have an application which users are assigned to work orders and the dates of their work. What I would like to do is when the form is submitted, to check the dates on the form against any work orders in the DB with that users name on it. If there is a conflict, I would like to have those Work Order numbers displayed in a message box. Is this possible to have the results of a recordset display in a message box?
Thanks,
Parallon
glenngv
07-25-2006, 03:28 AM
Loop through the recordset and then store the Work Order numbers in a string and then embed it in javascript alert.
<%
...
dim workOrderNo
workOrderNo=""
while not rs.EOF
workOrderNo = workOrderNo & rs("WorkOrderNoColumn") & "\n"
rs.movenext
wend
%>
<script type="text/javascript">
window.onload = function(){
var duplicates = "<%=workOrderNo%>";
if (duplicates) {
alert("The following Work Order numbers already exist:\n\n" + duplicates);
}
}
</script>
parallon
07-26-2006, 05:09 AM
I want to thank you very much. That worked perfectly, but now I just have to refine my query to eliminate duplicates.
Thanks again,
Parallon
glenngv
07-26-2006, 05:25 AM
Use the keyword DISTINCT in your query to get unique records.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.