Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String variable in LIKE query criteria gets attacked by " " quotes 1

Status
Not open for further replies.

ReCycled

Technical User
Dec 30, 2001
19
GT
Havent slept for three days trying to get a simple thing to work.

We use a form to report work in progress status. It has a comb box to select current stepname, but since not all steps apply to all job types, we added a text field to the table used by combo box for selection, with the job-type Id#. Say: 1,3,4,5 on one stepname 2,4,5 on another stepname, etc, the numbers corresponding to jobtypes.

We then changed the box to use a query (one table) with criteria on the text field:
Like "*" & [Form..]![IdType#] & "*"
This works fine for the first record, but does not change when the form passes to the next record (JOB) with diffrent job-type Id#.

Tried to fix that with "on enter" event procedure on comb box, that produces a new string with the correct IdType# each time the record moves, to use as the qry criteria. Was able to produce a str that evaluated to say:
Like "*5*"
or to
"*5*"
but the str, or Like str, written on the query criteria gets automatically attacked by Access and changed to "strCri" or Like "strCri" with no results. Like [str] does not work either.

What am I doing wrong? Is there a simpler way to get the combo box to present only those steps that apply to the job type?

Keep it simple, you can see I'm no expert.
 
Many thanks to Christiann from Belgium,

the FAQ was not an exact fit, but it did help me think. Problem is now solved.

Send me yr e-mail and I'll send you a postcard.
Enrique Maza from Guatemala
mazaenrique@hotmil.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top