forms_are_nightmares
Registered User.
- Local time
- Today, 05:20
- Joined
- Apr 5, 2010
- Messages
- 71
Hello All,
I'm trying to create a search within a form and keep receiving a "sytax error in FROM clause" and I can't figure out why. Any help/insight would be appreciated.
From a button labeled "search" on the form, I have in the OnClick property:
Option Compare Database
Option Explicit
Private Sub Button_Search_Click()
Me.frm_search_subform.Form.RecordSource = "SELECT * FROM qry_search " & BuildFilter
Me.frm_search_subform.Requery
End Sub
Private Function BuildFilter() As Variant
Dim varWhere As Variant
varWhere = Null
If Me.Company > "" Then
varWhere = varWhere & "[Company Name on W-9] LIKE """ & Me.Company & "*"" AND "
End If
BuildFilter = varWhere
End Function
Essentially, I want to get it to work for the first box and then integrate others.
Thanx
I'm trying to create a search within a form and keep receiving a "sytax error in FROM clause" and I can't figure out why. Any help/insight would be appreciated.
From a button labeled "search" on the form, I have in the OnClick property:
Option Compare Database
Option Explicit
Private Sub Button_Search_Click()
Me.frm_search_subform.Form.RecordSource = "SELECT * FROM qry_search " & BuildFilter
Me.frm_search_subform.Requery
End Sub
Private Function BuildFilter() As Variant
Dim varWhere As Variant
varWhere = Null
If Me.Company > "" Then
varWhere = varWhere & "[Company Name on W-9] LIKE """ & Me.Company & "*"" AND "
End If
BuildFilter = varWhere
End Function
Essentially, I want to get it to work for the first box and then integrate others.
Thanx