Straight to the point - I have a form built, based on a table of master data, that has a search box at the top -
So far I have this working to search for key values, names with wildcard capability, and project names with wildcard capability -
The issue I'm having is when searching for ANY WORD in the project name, it's only working on the first word of the field.
Code as follows -
Private Sub btnSearch_Click()
DoCmd.OpenForm "frmViewRecord", , , "[DKey]='" & Me.txtKeywords & "' OR [SIARef]='" & Me.txtKeywords & "' OR [ProjectName] like'" & Me.txtKeywords & "*' OR [TransitionManager] like'" & Me.txtKeywords & "*'"
If IsNull(Me.txtKeywords) Then
MsgBox "Please type in your search keyword."
Me.txtKeywords.SetFocus
End If
End Sub
Everything works fine - I have no errors - I just can't get it to search anything other than the first word of the project name, so for example, there's a project called "Project Lotus". If I search 'pro' it finds it, if I search 'lotus', NOTHING.
I have searched and searched, and every solution has caused me to get errors, e.g.
DoCmd.OpenForm "frmViewRecord", , , "[DKey]='" & Me.txtKeywords & "' OR [SIARef]='" & Me.txtKeywords & "' OR [ProjectName] like ""*" '" & Me.txtKeywords & "*' OR [TransitionManager] like'" & Me.txtKeywords & "*'"
The additional wildcard ""*" was suggested, and I've fiddled around with this for a while now, and I get nothing but errors, e.g. Runtime error 3075 - Syntax error :
I'm new to VBA (and all code to be honest), so if there's a simple fix I'm missing, please don't worry about insulting my intelligence!
Any help is welcome (but please avoid telling me to use macros and queries)
Thanks in advance!