What is the syntax to refer to the Value selected in a combo box in an Access 2000 Form, in the WHERE command of a stored procedure.<br>
<br>
Thanks in advance,<br>
<br>
Simon
First you need to place your value in a variable in access. Then you need to execute your sp - something like:<br>
<br>
Dim adoCon = ADODB.Connection;<br>
Dim adoComm = ADODB.Command;<br>
Dim strVal as String;<br>
<br>
Set adoCon = new ADODB.Connection;<br>
Set adoComm = new ADODB.Command;<br>
<br>
'You now need to initialise your connection string<br>
..........<br>
<br>
strVal = "EXEC SP_NAME ' & cmbCombo.Value & "'";<br>
<br>
With adoComm<br>
.ActiveConnection = adoCon<br>
.CommandType = adStoredProcedure 'Check this from drop down<br>
.Text = strVal<br>
.Execute<br>
End With<br>
<br>
You need to check some of the sytax above (I don't have access to VB at the moment. However this will give you an idea.<br>
<br>
Cal<br>
The data you want isn't available to the stored procedure when it runs. It has to be passed as a parameter (or included in the SQL Source.)<br>ADO has support for parameters, so you don't have to build the string. Get the WROX book on ADO (or sit at Borders and drink a cup'o joe.) Check out the ADO Command Object.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.