By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Linking a Text Box in a Form to the Criteria in a Query using "Like"

P: 5
I have tried just about everything that I can think of, so now I turn to you all for help!

I have created a form (titled "OAG") with an unbound textbox titled "DOW". I also have a Query that I have set up to return results using the abbreviations for the day of the week, and periods when that day is not present. For example, if the pattern is Monday, Wednesday, Friday, the query shows it as "Mon.Wed.Fri.." (periods replace Tues, Thurs, Sat, and Sun). There are several thousands of records with this type of pattern.

When I type in "Like *Mon*" in the criteria for the query, it returns only those results that contain Monday... which is perfect. However, I would like to link the form to the query so that when I type in "Mon" in the text box on the form, and then run the query, only the records that contain "Mon" show. I have created a report and a command button so that ultimately when I work out all the kinks, I can click the command button on the form and a report will pop up showing only the records that contain those days that I typed into the box.

I have tried to type "[Forms]![OAG]![DOW]" into the criteria of the query to link the two, but no data returns when I test it. I have also tried just about every combination of "Like" "Mon" "*" and "[Forms]![OAG]![DOW]" that I can possibly think of.

Any suggestions? I have the sql code available if needed... any help is GREATLY APPRECIATED!!
Aug 15 '07 #1
Share this Question
Share on Google+
4 Replies


JConsulting
Expert 100+
P: 603
I have tried just about everything that I can think of, so now I turn to you all for help!

I have created a form (titled "OAG") with an unbound textbox titled "DOW". I also have a Query that I have set up to return results using the abbreviations for the day of the week, and periods when that day is not present. For example, if the pattern is Monday, Wednesday, Friday, the query shows it as "Mon.Wed.Fri.." (periods replace Tues, Thurs, Sat, and Sun). There are several thousands of records with this type of pattern.

When I type in "Like *Mon*" in the criteria for the query, it returns only those results that contain Monday... which is perfect. However, I would like to link the form to the query so that when I type in "Mon" in the text box on the form, and then run the query, only the records that contain "Mon" show. I have created a report and a command button so that ultimately when I work out all the kinks, I can click the command button on the form and a report will pop up showing only the records that contain those days that I typed into the box.

I have tried to type "[Forms]![OAG]![DOW]" into the criteria of the query to link the two, but no data returns when I test it. I have also tried just about every combination of "Like" "Mon" "*" and "[Forms]![OAG]![DOW]" that I can possibly think of.

Any suggestions? I have the sql code available if needed... any help is GREATLY APPRECIATED!!
Have you tried

Like "*" & [Forms]![OAG]![DOW] & "*"
Aug 16 '07 #2

puppydogbuddy
Expert 100+
P: 1,923
I have tried just about everything that I can think of, so now I turn to you all for help!

I have created a form (titled "OAG") with an unbound textbox titled "DOW". I also have a Query that I have set up to return results using the abbreviations for the day of the week, and periods when that day is not present. For example, if the pattern is Monday, Wednesday, Friday, the query shows it as "Mon.Wed.Fri.." (periods replace Tues, Thurs, Sat, and Sun). There are several thousands of records with this type of pattern.

When I type in "Like *Mon*" in the criteria for the query, it returns only those results that contain Monday... which is perfect. However, I would like to link the form to the query so that when I type in "Mon" in the text box on the form, and then run the query, only the records that contain "Mon" show. I have created a report and a command button so that ultimately when I work out all the kinks, I can click the command button on the form and a report will pop up showing only the records that contain those days that I typed into the box.

I have tried to type "[Forms]![OAG]![DOW]" into the criteria of the query to link the two, but no data returns when I test it. I have also tried just about every combination of "Like" "Mon" "*" and "[Forms]![OAG]![DOW]" that I can possibly think of.

Any suggestions? I have the sql code available if needed... any help is GREATLY APPRECIATED!!
Try this syntax in the criteria row of your query:

Like "*" & Forms![OAG]![DOW] & "*"
Aug 16 '07 #3

JConsulting
Expert 100+
P: 603
Try this syntax in the criteria row of your query:

Like "*" & Forms![OAG]![DOW] & "*"
Great minds eh PDB!!
Good to see you out and around. Hope all is well.
J
Aug 17 '07 #4

puppydogbuddy
Expert 100+
P: 1,923
Great minds eh PDB!!
Good to see you out and around. Hope all is well.
J

Jeff!!

Have been so busy lately that I did not even realize that anybody had responded to this post until now. Hope you are happy in your new job and wishing you the best.....I am sure you are showing them the way it's done....

pDog
Aug 17 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.