A
Andre
Hi,
I need to fetch a value in an Access db, so i use a form to pass the
parameter for the SQL statement fromVB client to ASP. After the submit line
in VBscript, i expect the value in order to test it and go further in
VBscript. But my problem is when clicking on the button, that the VB code
doesn't wait to get that value and continues directly, so the a=<%=totd%>
line give 0 in stead of the real value. If i click a second time, i get the
value.
Any way to let de VB code after dtot.submit wait before it gets the value?
See the code:
<%
totd = 0
dat=Request.Form("dt")
If Request.Form("dt") <> "" Then totd = records()
Function records()
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=d:\access\newres.mdb")
sql="select logon, count(uur) as totdag from studres where cdate(dag)='" &
dat & "' "
set rs=Server.CreateObject("ADODB.recordset")
rs.open sql, objdc, 3, 3
records=rs.recordcount
Set rs = Nothing
End Function
%>
<html><head><title>Nieuwe pagina 1</title></head><body>
<script language=vbscript>
sub hfd_onclick()
a=0
dat="6/30/2004"
document.getElementById("dt").value=dat
dtot.action="test3.asp" '=name of this file
dtot.method="post"
dtot.submit
'too fast here
a=<%=totd%> '=0 on the first click, the real value on the second
click
msgbox a
end sub
</script>
<form name=dtot>
<input name="dt" type="hidden" value="" >
<INPUT name=hfd TYPE="button">
</form>
Thanks
andré
I need to fetch a value in an Access db, so i use a form to pass the
parameter for the SQL statement fromVB client to ASP. After the submit line
in VBscript, i expect the value in order to test it and go further in
VBscript. But my problem is when clicking on the button, that the VB code
doesn't wait to get that value and continues directly, so the a=<%=totd%>
line give 0 in stead of the real value. If i click a second time, i get the
value.
Any way to let de VB code after dtot.submit wait before it gets the value?
See the code:
<%
totd = 0
dat=Request.Form("dt")
If Request.Form("dt") <> "" Then totd = records()
Function records()
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=d:\access\newres.mdb")
sql="select logon, count(uur) as totdag from studres where cdate(dag)='" &
dat & "' "
set rs=Server.CreateObject("ADODB.recordset")
rs.open sql, objdc, 3, 3
records=rs.recordcount
Set rs = Nothing
End Function
%>
<html><head><title>Nieuwe pagina 1</title></head><body>
<script language=vbscript>
sub hfd_onclick()
a=0
dat="6/30/2004"
document.getElementById("dt").value=dat
dtot.action="test3.asp" '=name of this file
dtot.method="post"
dtot.submit
'too fast here
a=<%=totd%> '=0 on the first click, the real value on the second
click
msgbox a
end sub
</script>
<form name=dtot>
<input name="dt" type="hidden" value="" >
<INPUT name=hfd TYPE="button">
</form>
Thanks
andré