pass parameter query ? (1 Viewer)

qwertyjjj

Registered User.
Local time
Yesterday, 20:33
Joined
Aug 8, 2006
Messages
262
Bit stuck here as to how to pass a parameter to the query:

So far, I've got:
Private Sub combo_DivLevel_Change()

If combo_DivLevel.SelText = "All Divisional Levels" Then
Call Populate_DropDowns("", "")
ElseIf Len(combo_DivLevel.Text) = 5 Then
Dim db As Database 'current database
Dim rs As Recordset 'holds query resultset
Dim qdfParmQry As QueryDef 'the actual query object
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("DivisionalLevelSpecific")
qdfParmQry("DivisionalLevel?") = combo_DivLevel.SelText
Set rs = qdfParmQry.OpenRecordset()
Form.RecordSource = rs
End If

End Sub

I need to change the form's recordsource to the query with a passed parameter and reload the data anytime the combo box is changed...
 

FireStrike

Registered User.
Local time
Yesterday, 23:33
Joined
Jul 14, 2006
Messages
69
I believe you want to do something like the following.

Set rs = CurrentDb.OpenRecordset("DivisionalLevelSpecific")

Hope this helps
 

Users who are viewing this thread

Top Bottom