Need macro to run query, open form and display query results in form fields

D

denilynn

I have a log-in form with a lab code as the primary key.
I'm using a Yes/No checkbox in this form and my query is
based on this box. The user fills in the form and checks
the Yes/No box in front of the new lab code. The user then
uses a button to open a second form whose fields will be
populated with results of the query based on the Yes/No
field on the original form. In other words, I want the
following events to take place and need a macro to run
them: 1. Run query based on original form's Yes/No box. 2.
Close query. 3. Open second form and have fields populated
with fields from query results. Also, will the query
results be replaced each time a new lab code and Yes/No
box is used? Thanks in advance for your help!
 
S

Steve Schapel

Denilynn,

Could you please provide more details, maybe with examples, of what you
really want to achieve here? I'm afraid I can't quite grasp your
meaning so far. Do you mean that the query is an Append Query or an
Update Query? And that you only want it to run is the Yes/No field is
Yes? So what is the relationship between the data as shown on the two
forms?
 
D

denilynn

The login form (#1) is used to log in water sample info
and the login code is the primary key. From this form (#1)
the user can choose from 4 different options (forms)(#2)
depending on what type of entity is submitting the water
sample. I'd like to attach a macro to each of the 4
command buttons for the 4 entities that will open the
appropriate form (#2)for the entity chosen. My login form
(#1) will have numerous lab code #s, so I'll have the
inputter check a Yes/No checkbox, run a query based on
the "yes" checkboxes, and the query results will populate
the fields in the form (#2) that was chosen for the
specific entity.

I believe the query would be an update query. It will be
based on Yes using the Yes/No field.

The relationship of the data on the two forms is that it
would be the same data. The login form (#1) will have more
information on it than what is needed for form #2).

Am I way off?

Thank you!
 

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