In my database, I've got records that are identified by a ordinance number, entry date, and a detail field. I'd like to create a form that will perform a text search of the [details] field. I have a basic text search that uses a query with the Like command. I'd like to allow the search to be more advanced, like a boolean search.
When the "submit" button is clicked, the following code is run:
Dim strstring As String
Dim strmodified As String
strstring = Me!textstring
If InStr(strstring, "*") = 1 Then
DoCmd.OpenForm "frmOrdinance_viewonly_detailquery" 'note, i just noticed the docmd above is repeated after the if statement
Else
strmodified = "*" + strstring + "*"
Me!textstring = strmodified
End If
DoCmd.OpenForm "frmOrdinance_viewonly_detailquery"
DoCmd.Close acForm, "frmDetailQueryOrdinance_viewonly"
The [textstring] field is inserted in a Like expression..that's why I used the wildcards. I know there is better way to do this. I just haven't done VBA or access in quite a while.
When the "submit" button is clicked, the following code is run:
Dim strstring As String
Dim strmodified As String
strstring = Me!textstring
If InStr(strstring, "*") = 1 Then
DoCmd.OpenForm "frmOrdinance_viewonly_detailquery" 'note, i just noticed the docmd above is repeated after the if statement
Else
strmodified = "*" + strstring + "*"
Me!textstring = strmodified
End If
DoCmd.OpenForm "frmOrdinance_viewonly_detailquery"
DoCmd.Close acForm, "frmDetailQueryOrdinance_viewonly"
The [textstring] field is inserted in a Like expression..that's why I used the wildcards. I know there is better way to do this. I just haven't done VBA or access in quite a while.