Help with expression

Access Virgin

Registered User.
Local time
Today, 06:05
Joined
Apr 8, 2003
Messages
77
I am trying to use a multi select list box to create the WHERE criteria for a query, the criteria will be one name or more, so far I can get the WHERE part created except for the " " around the names

my code

listvalues = listvalues & "(((Table1.RaisedBy)=" & Me.RaisedByList.Column(0, I) & ")) OR "

my result
(((Table1.RaisedBy)=JOE BLOGGS)) OR (((Table1.RaisedBy)=DAVE SMITH))

required result
(((Table1.RaisedBy)="JOE BLOGGS")) OR (((Table1.RaisedBy)="DAVE SMITH"))

Can this be done?
 
Easiest solution might be to use single quotes

i.e.

listvalues = listvalues & '"(((Table1.RaisedBy)=" & Me.RaisedByList.Column(0, I) & "')) OR "

should deliver

(((Table1.RaisedBy)='JOE BLOGGS')) OR (((Table1.RaisedBy)='DAVE SMITH'))

Hopefully that will work, but may not, depending on your specific circumstances.
 
I saw my fortune teller yesterday.
She was smilling; so I slapped her.
(I always like to strike a happy medium)

LOL :D :cool:
 

Users who are viewing this thread

Back
Top Bottom