Synttax for opening report with where clause (1 Viewer)

Monoceros

Registered User.
Local time
Today, 09:09
Joined
Oct 30, 2006
Messages
27
I don't seem to get the right syntax for opening a report with only the records where the field Reference equals UD :

DoComd.OpenReport "rptCosts", acViewPreview, , Reference= "UD"

What's wrong with the syntax ?
 

Ranman256

Well-known member
Local time
Today, 04:09
Joined
Apr 9, 2015
Messages
4,339
'strings must have quotes
DoComd.OpenReport "rptCosts", acViewPreview,"[fieldname]='UD'"
or
DoComd.OpenReport "rptCosts", acViewPreview,"[fieldname]='" & txtString & "'"

numbers
DoComd.OpenReport "rptCosts", acViewPreview,"[fieldname]=" & txtNum
 

Monoceros

Registered User.
Local time
Today, 09:09
Joined
Oct 30, 2006
Messages
27
Thank you.
 

Users who are viewing this thread

Top Bottom