Hello, I have an account search form that I use in my database.
I have a module with this code
and then in the query behind the form I have
Today I have also tried to add search facility to ContactName as well as AccountName but the problem is that whilst all accounts have AccountName not all accounts have a ContactName.
I have added the "where" code to the search form for ContactName but when the search form 1st opens it only lists those records which have a ContactName and I need the form to list all of the accounts irrespective of whether they have a value in ContactName.
I am not sure whether I need to amend the WHERE criteria or whether I need a line in the module to deal with blank records so could I ask for help and suggestions please.
The module code is not mine, it was supplied by a colleague but on searching I see it has been used in this forum before so I am hoping someone may be able to help.
Thanks as always.
I have a module with this code
Code:
Function RemovePunc(varText As Variant) As Variant
Dim strRemoveThese As String
Dim intI As Integer
strRemoveThese = "'()/,"
If Not IsNull(varText) Then
For intI = 1 To Len(strRemoveThese)
varText = Replace(varText, Mid(strRemoveThese, intI, 1), "")
Next
End If
RemovePunc = varText
End Function
Code:
WHERE (((RemovePunc([tblFarmerDetails].[AccountName])) Like "*" & [Forms]![frmSearch]![Search2] & "*")
Today I have also tried to add search facility to ContactName as well as AccountName but the problem is that whilst all accounts have AccountName not all accounts have a ContactName.
I have added the "where" code to the search form for ContactName but when the search form 1st opens it only lists those records which have a ContactName and I need the form to list all of the accounts irrespective of whether they have a value in ContactName.
I am not sure whether I need to amend the WHERE criteria or whether I need a line in the module to deal with blank records so could I ask for help and suggestions please.
The module code is not mine, it was supplied by a colleague but on searching I see it has been used in this forum before so I am hoping someone may be able to help.
Thanks as always.