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

Run Query from 2 forms 2

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
In my DB I have two Forms that I work with. One form shows training by selected instructor. The other shows training for All instructors.

On the first form I have buttons that cause update queries to run. Each query is dependent on 2 field values from the form..Employee number...and Unit assigned to.

Now, the users have asked for the second form (All instructors) to show, so they can page through all the instructors without having to select individuals.

But...I want the buttons on the second form to compute the same update values it does for the first form.

Question: Is there a way to have dependent data from two different forms control a query. Like "FormA employee number Or FormB employee number" I have tried this, with the proper syntax of course, and it still askes for the first forms information. I have lots of buttons on each form and really do not want to create more queries.

Thanks,
 
Use command button in your app like dhookom suggests, and use TAGs to show your code here, please!

You commented out:[tt]
MsgBox "Values are: " & Bems_ID & ", and AC value is " & AC[/tt]
because it was complainihg about undeclared variables, so now you know what Option Explicit is for :)

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Very good catch...I have learned a lot in the last two day. So, do you think I should save the record "After Update"...and then use a command button to run the code?

How about the refreshes I need to do to the form to show the new updated data. How should I mechanize that?
 
To refresh a form, use Me.Refresh. This won't show new records but should display updated values. You could also use Me.Requery.

Again, I would rely on the user making a decision to update the records. You could add some code that enables the command button if a value changes. You could use more code that would determine if the record had been updated prior to leaving the form or record.

Duane
Hook'D on Access
MS Access MVP
 
OK. Good suggestions. I will set the accessibility of the buttons you suggested. I am fairly good at doing that. I will also make a strong recommendation to my project user in favor of the button.

You have mentioned a few times to use tags when showing code. Can you show me what you mean. Copy some of the code I sent and add the tags in a different color. I really want to communicate clearly when I ask for help... or, someday provide help to others.

Thanks
 
or you can just type it in: [tt]
[ignore]
Code:
[/ignore]
Option Explicit
[green]
'Some code goes here[/green][ignore]
[/ignore]
[/tt]
shows like this:

Code:
Option Explicit
[green]
'Some code goes here[/green]

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top