Hi there,
Can anybody help me and provide me with a SIMPLE solution to create a search form in Access 2003.
I have created a database for Finance Payments and want to enable the user to search on a number of different fields and to return records that meet the criteria in a subform below.
I'm testing this at the moment. So far i have:
3 unbound text boxes (to input the search parameters)
* TxtName (Name of Payee)
* TxtDate2 (Date)
* TxtInvoice (Invoice Number)
A sub form (frm_subformsearch) based on a query (qry_searchform) which gives me a list of all the records.
I'm basically stuck on the coding for selecting where the text boxes meet the criteria and returning these in the sub form.
I have downloaded a code from a website but it's not working - Can you tell me where i'm going wrong. Please note the code below is as was downloaded - i've not posted what i tried to do to tailor it to my database
Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim varColor As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
varColor = Null ' Subfilter used for colors
' Check for LIKE First Name
If Me.txtFirstName > "" Then
varWhere = varWhere & "[FirstName] LIKE """ & Me.txtFirstName & "*"" AND "
End If
' Check for LIKE Last Name
If Me.txtLastName > "" Then
varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & "*"" AND "
End If
Please help!
Thank you,
Nia x