Hi everyone,
I am struggling with running a query using a subform query linked to a combo box...
Basically I have a combo box and a subform on a page and the user clicks on a field in the combo box and presto the subform updates with the relevant info...
Now on the combo box I have added the code
DoCmd.OpenQuery stdocname, stLinkCriteria = rs.EOF
This opens a query with all the same fields as the subform.
The query, askes for date from and date to criteria and you fill these in and it generates the data sheet with all records pertaining to these dates...only problem is that the selected officer code (selected with the combo box) is not pulled through...even though the code is on the combo box and referencing variables it has within it.
Please could anyone help, it would greatly be appreciated
The code for the combo box is below:
Private Sub Combo0_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim stdocname As String
stdocname = "DateTo&From No of Apps Per Officer DateQ"
Set rs = Me.Recordset.Clone
rs.FindFirst "[OFFCODE] = '" & Me![Combo0] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.OpenQuery stdocname, stLinkCriteria = rs.EOF
End Sub
I am struggling with running a query using a subform query linked to a combo box...
Basically I have a combo box and a subform on a page and the user clicks on a field in the combo box and presto the subform updates with the relevant info...
Now on the combo box I have added the code
DoCmd.OpenQuery stdocname, stLinkCriteria = rs.EOF
This opens a query with all the same fields as the subform.
The query, askes for date from and date to criteria and you fill these in and it generates the data sheet with all records pertaining to these dates...only problem is that the selected officer code (selected with the combo box) is not pulled through...even though the code is on the combo box and referencing variables it has within it.
Please could anyone help, it would greatly be appreciated
The code for the combo box is below:
Private Sub Combo0_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim stdocname As String
stdocname = "DateTo&From No of Apps Per Officer DateQ"
Set rs = Me.Recordset.Clone
rs.FindFirst "[OFFCODE] = '" & Me![Combo0] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.OpenQuery stdocname, stLinkCriteria = rs.EOF
End Sub