Hi
I have a form (Company) with a subform (Areas Inc Lay Company)
The subform has a combo box (country)
(record#) and (areas#) are the related fields in the underlying tables
With a command button (company_find_bareboat_operators_spain), on the main form I would like to filter records by the value of the combo box, in this example the value is Spain
Here is the buttons script;
-----------------------------
Private Sub company_find_bareboat_operators_spain_Click()
On Error GoTo Err_company_find_bareboat_operators_spain_Click
Dim stDocName As String
Dim strLinkCriteria As String
stDocName = "company_find_bareboat_operators_spain"
strLinkCriteria = "[record#] = Forms![Areas Inc Lay Company]![areas#]"
DoCmd.ApplyFilter , "Forms![Areas Inc Lay Company]![country] = 'Spain'"
Exit_company_find_bareboat_operators_spain_Click:
Exit Sub
Err_company_find_bareboat_operators_spain_Click:
MsgBox Err.Description
Resume Exit_company_find_bareboat_operators_spain_Click
End Sub
--------------------------
When I click on the button I get a "Enter Parameter Value" popup box asking for Forms!Areas Inc Lay Company!country. If I type in Spain the filter returns all records
Any help much appreciated
I have a form (Company) with a subform (Areas Inc Lay Company)
The subform has a combo box (country)
(record#) and (areas#) are the related fields in the underlying tables
With a command button (company_find_bareboat_operators_spain), on the main form I would like to filter records by the value of the combo box, in this example the value is Spain
Here is the buttons script;
-----------------------------
Private Sub company_find_bareboat_operators_spain_Click()
On Error GoTo Err_company_find_bareboat_operators_spain_Click
Dim stDocName As String
Dim strLinkCriteria As String
stDocName = "company_find_bareboat_operators_spain"
strLinkCriteria = "[record#] = Forms![Areas Inc Lay Company]![areas#]"
DoCmd.ApplyFilter , "Forms![Areas Inc Lay Company]![country] = 'Spain'"
Exit_company_find_bareboat_operators_spain_Click:
Exit Sub
Err_company_find_bareboat_operators_spain_Click:
MsgBox Err.Description
Resume Exit_company_find_bareboat_operators_spain_Click
End Sub
--------------------------
When I click on the button I get a "Enter Parameter Value" popup box asking for Forms!Areas Inc Lay Company!country. If I type in Spain the filter returns all records
Any help much appreciated