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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using "Like" In The Query Of Subform

Status
Not open for further replies.

matethreat

Technical User
Jan 5, 2004
128
0
0
AU
Hello,

I am trying to filter a subform that is based on an item selected in a combo box.

What I have is a Combo box that lists job numbers (with a text format) and a subform that lists all the people who worked on that job.

My problem is that in the Job Number field of the subform an employee may have worked on several jobs in a day, and all those numbers are entered into one text string.

For example:

John Doe Worked On 040511/041276/041388

If I create a query on it's own I can put the following criteria in it and John Doe appears in the list.

crtieria: like "*040511*"

I would like to do something similar with the filtering of my subform, but because I am using my combo box as the source of the job number I can't seem to get the same result.

I have used the following criteria:
Like [Forms]![Scheduling]![Combo8]

Which will only match employees who have worked on the one job in a day. I have tried several methods but I cannot get the result.

Does anyone have any ideas.

Thank You

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Thanks Ken,

I still get the same result, only exact matches to Combo8.

Aaron

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Hi

Lets just get this clear, you get only those EE's who haev worked on only one job and that job is that selected in teh combo box?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
That's correct.

This is what I am looking to achieve.

If I select in combo8
040511

I would like the result to show all of the following in the subform.

John Doe 040511
Jane Doe 041286/040511
Jack Doe 040511/041388/042003

etc.......

Thanks


Destiny Is Not The Chances We Take, But The Descisions We Make.
 
I assume the combo box the field that links the main form and the subform?
 
Yes It Is.

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Hi

"I assume the combo box the field that links the main form and the subform?"

the use of the word "links" makes me wonder are you using the Master/Child link properties of the sub control?, if yes you cannot use Like there

I assumed your subform was based on a query with a criteria of Like "*" & [Forms]![Scheduling]![Combo8] & "*", in which case I feel it should work, you will of course need a MySubformControl.Requery type statement in the after update event of Combo8

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

Thank you for your efforts. I created a query seperate to the subform and used that query for the data in my subform, rather then direct from the tables, and it works.

Thank You

Aaron

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top