Data Access Page and Dependant Combo Box's

A

Alia$Corps

Hi,

Im using access 2002 and have been trying to create a dependant combo box on
my data access page, the idea behind this is so my first combo box will allow
you to chose a state, and the second combo box will allow you to chose a
selection only relavant to that state. both values are being stored in the
database and have had no problems getting this to work off a form, by
creating a Parameter Query which runs of the result of the first combo box
and having an event after update rerun the query, however i've spent the
better part of today trying to do this same thing using a data access page,
and can't seem to be able to get it to work, any suggestions would be mint
and greatly appriciated.

Thanks
 
S

Sylvain Lafontaine

Values in parameters are passed ByRef, not ByVal; so the most probable cause
of your failure is that you have used local variables instead of global
variables:

Dim GlobalValue

Sub MySub
Dim LocalValue

With msodsc.RecordsetDefs ("dbo.MyCombo_StoredProcedure")
.parametervalues.Add "@V1", LocalValue
.parametervalues.Add "@V2", GlobalValue
End With

End Sub

In this exemple, the first parameter V1 will cause you problem because it is
referencing a local variable.

However, trying to manipulate many parameters at the same time under DAP
will lead you to nowhere. A better idea would be to collect the information
in a cookie and refresh the whole page in the OnChange event (the
definition of the subroutine SetCookie(...) is personal) :

<SCRIPT language=vbscript event=onchange for=Combo1>
<!--
SetCookie "Value1", Combo1.value
window.location.reload()
-->
</SCRIPT>

Of course, instead of using cookies, you can also add the value at the end
of the window.location.href property. Finally, there is a newsgroup about
DAP: m.p.access.dataaccess.pages .
 
Top