Query coding with variable criterea entered from a form

  • Thread starter JohnG via AccessMonster.com
  • Start date
J

JohnG via AccessMonster.com

I've created a form in which the user can enter in different text boxes from
1 to 20 account numbers (1 account # per text box).

Then, by pressing a command button a "DoCmd.OpenQuery" will be executed using
all the account #'s entered in the text boxes as the criterea for selecting
which records from the table should appear in the query.

Any suggestions on how I would code the crierea section of the account field
of the table in Query design

Thanks,
JohnG
 
G

Guest

A different approach would be to build a reference table with two fields -
Account and Yes/No.
Display this in a subform that is not Master/Child linked. Use the check
boxes to tick off the accounts to pull data on.

In your query add the reference table, not joined, and use the Account field
as criteria and the Yes/No field as -1.

Have the form to reset the Yes/No field of the table on opening. Use your
command button for the "DoCmd.OpenQuery".
 
J

JohnG via AccessMonster.com

Thanks for your help Karl

JohnG


KARL said:
A different approach would be to build a reference table with two fields -
Account and Yes/No.
Display this in a subform that is not Master/Child linked. Use the check
boxes to tick off the accounts to pull data on.

In your query add the reference table, not joined, and use the Account field
as criteria and the Yes/No field as -1.

Have the form to reset the Yes/No field of the table on opening. Use your
command button for the "DoCmd.OpenQuery".
I've created a form in which the user can enter in different text boxes from
1 to 20 account numbers (1 account # per text box).
[quoted text clipped - 8 lines]
Thanks,
JohnG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top