G
G
I am trying to set the recordsource of a combobox a parameter query with
the combo box wizard, but get an error message that one of the parameter
will not be assigned a value. This is understandable, as the query is a one
parameter query who value is equals to a field on a form.
Is there a way to do this?
I tried writing a procedure that would open up a recordset and get the same
data as the query then set the combobox recordsource equal to the Recordset,
but this did not work.
Any ideas?
Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim RS As Recordset
Dim strSQL As String
Set RS = New ADODB.Recordset
strSQL = "SELECT Part_ID FROM ESIDB.dbo.SOFSN SOFSN WHERE
(Serial_NUmber)='" & Forms("FrmRMARequest")("SN") & "'"
RS.Open strSQL,
"Provider=SQLOLEDB;server=sqlserver2;uid=crystal;pwd=esi;DSN=esi",
adOpenStatic
Me("ComboMultipleUnits").RecordSource = RS
End Sub
the combo box wizard, but get an error message that one of the parameter
will not be assigned a value. This is understandable, as the query is a one
parameter query who value is equals to a field on a form.
Is there a way to do this?
I tried writing a procedure that would open up a recordset and get the same
data as the query then set the combobox recordsource equal to the Recordset,
but this did not work.
Any ideas?
Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim RS As Recordset
Dim strSQL As String
Set RS = New ADODB.Recordset
strSQL = "SELECT Part_ID FROM ESIDB.dbo.SOFSN SOFSN WHERE
(Serial_NUmber)='" & Forms("FrmRMARequest")("SN") & "'"
RS.Open strSQL,
"Provider=SQLOLEDB;server=sqlserver2;uid=crystal;pwd=esi;DSN=esi",
adOpenStatic
Me("ComboMultipleUnits").RecordSource = RS
End Sub