DoCmd.OpenReport (from combobox) (1 Viewer)

Access_Help

Registered User.
Local time
Today, 14:27
Joined
Feb 12, 2005
Messages
136
DoCmd.OpenReport sRpt, acPreview, , "[First_Name]= '" & List13.Column(1) & "'" And [Progress] = "Me.[Combo26]"

Can someone please help me fix the syntax error in this line.

I have a form with a listbox and a combo.

I have added the second search criteria And [Progress] = "Me.[Combo26]",

I am recieving a run time error 2465 - can't find the field '1' referred in your expression.

The first search criteria from the listbox works fine.

Thanks in advance.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:27
Joined
May 21, 2018
Messages
8,528
I am guessing there is no field called Progress in your report. Fields are zero based.
 

Minty

AWF VIP
Local time
Today, 22:27
Joined
Jul 26, 2013
Messages
10,371
You haven't concatenated the string correctly, try this; (I've assumed Progress is a text field, if not remove the additional ' ' around combo26 value).

Code:
Dim sWhere as String

sWhere =  "[First_Name]= '" & List13.Column(1) & "' And [Progress] = '" & Me.[Combo26] & "'"

Debug.Print sWhere

DoCmd.OpenReport sRpt, acPreview, , sWhere
 
Last edited:

Users who are viewing this thread

Top Bottom