Tupacmoche
Registered User.
- Local time
- Today, 08:28
- Joined
- Apr 28, 2008
- Messages
- 291
This seems straight forward enough but, I keep getting a Run-time error 3131 message: Syntax error in From clause.
Here is the code:
Private Sub btnFilter_Click()
Dim strSQL As String
strSQL = "Select * from qryOGA_Val where" & _
"Forms![OGA Management].Form![SubFilterTest].rec_Type = 'P" & "'"
DoCmd.RunSQL strSQL
End Sub
All, I've done is place a subform on a form added a query as the data source. The data source has codes type P, H, and J. What the filter button does is simple set it to one of these values. Can anyone see why, I getting this error any assistance is appreciated.
Additionally, is there a way to use this same button as a toggle so that, I can use it to un filter the subform?
Here is the code:
Private Sub btnFilter_Click()
Dim strSQL As String
strSQL = "Select * from qryOGA_Val where" & _
"Forms![OGA Management].Form![SubFilterTest].rec_Type = 'P" & "'"
DoCmd.RunSQL strSQL
End Sub
All, I've done is place a subform on a form added a query as the data source. The data source has codes type P, H, and J. What the filter button does is simple set it to one of these values. Can anyone see why, I getting this error any assistance is appreciated.

Additionally, is there a way to use this same button as a toggle so that, I can use it to un filter the subform?