468,457 Members | 1,682 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

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

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
4 3246
JConsulting
603 Expert 512MB
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
1,923 Expert 1GB
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
603 Expert 512MB
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
1,923 Expert 1GB
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.

Similar topics

reply views Thread by Bill Brinkworth | last post: by
11 posts views Thread by Bruce Lawrence | last post: by
5 posts views Thread by brino | last post: by
9 posts views Thread by Drum2001 | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.