G
Guest
I'm sorry my last post was ambiguous.
My form contains 2 combo boxes, the first box (Combo822) lists Makes from the
Oem table. When the user makes a choice I would like the form RecordSource
to change to a specific query. At the same time, the second combo box
(Combo2) should have it's RowSource property updated to the correct query.
This is the code I've written to change the RecordSource of the form:
Private Sub Combo822_AfterUpdate()
'after user choses make, change the forms' RecordSource to appropriate
query.
If Me!Combo822.Value = "Honda" Then
Dim pjm3 As ADODB.Connection
Set pjm3 = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = pjm3
'I put SQL statement in variable named pjm3SQL.
Dim pjm3SQL As String
pjm3SQL = "SELECT JOBS.ID, JOBS.MODEL, JOBS.Picture"
pjm3SQL = pjm3SQL + "FROM JOBS;"
Me.Recordset = pjm3SQL
End If
End Sub
I get no error message but the forms' RecordSource property does not update.
I have not programmed the second combo box because I'm unable to solve this
problem yet.
I would appreciate any and all help/suggestions.
Thank You,
Paul3rd
My form contains 2 combo boxes, the first box (Combo822) lists Makes from the
Oem table. When the user makes a choice I would like the form RecordSource
to change to a specific query. At the same time, the second combo box
(Combo2) should have it's RowSource property updated to the correct query.
This is the code I've written to change the RecordSource of the form:
Private Sub Combo822_AfterUpdate()
'after user choses make, change the forms' RecordSource to appropriate
query.
If Me!Combo822.Value = "Honda" Then
Dim pjm3 As ADODB.Connection
Set pjm3 = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = pjm3
'I put SQL statement in variable named pjm3SQL.
Dim pjm3SQL As String
pjm3SQL = "SELECT JOBS.ID, JOBS.MODEL, JOBS.Picture"
pjm3SQL = pjm3SQL + "FROM JOBS;"
Me.Recordset = pjm3SQL
End If
End Sub
I get no error message but the forms' RecordSource property does not update.
I have not programmed the second combo box because I'm unable to solve this
problem yet.
I would appreciate any and all help/suggestions.
Thank You,
Paul3rd