Filter report by text field wildard - help required

copsy1979

New member
Local time
Today, 13:17
Joined
Sep 7, 2008
Messages
6
Hi, I have succesfully created reports to be filtered using a date range and a client code but am struggling with the code required to filter by a text field. The process I use is as per "Allen browne" where you create a form to enter the required criteria.

The coding I have in the "preview" button on the form is as follows:

strReport = "rptSalesVolumebyClient"
strField = [CompanyName]
lngView = acViewPreview

If Not IsNull(Me.txtcompanyname) Then 'no name'
strWhere = strField & Like "*" & Format(Me.txtcompanyname,)
End If

I need to be able to enter part of company name so that report will show all branches for a particular company.

Can anyone assist?
Thanks in advance
 
If it is a text field then you need it in quotes.

Try
Code:
strReport = "rptSalesVolumebyClient"
strField = [CompanyName]
lngView = acViewPreview

If Not IsNull(Me.txtcompanyname) Then 'no name'
[COLOR=red]strWhere = strField & Like "'*" &  Me.txtcompanyname & "'"[/COLOR]
 
End If
 
Hi, tried this but it throws up error message

compile error
syntax error

Any suggestions?
 

Users who are viewing this thread

Back
Top Bottom