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!

Procedure order with existing macros in a command button

Status
Not open for further replies.

SoulBrutha23

Technical User
Sep 26, 2001
8
US
Here is the situation. I have a form that calculates data from text box to text box. At the bottom of the form, it has a totals text box that gives a total score. Next to that, I have a command button that will run a new record procedure. I would like to add some macros that will run some queries that I have built into this procedure, i.e. append queries. What is the order within this procedure that I should throw script into and how would I write these macros into the script?

Private Sub CmdNewWeek_Click()
On Error GoTo Err_CmdNewWeek_Click


DoCmd.GoToRecord , , acNewRec

Exit_CmdNewWeek_Click:
Exit Sub



Err_CmdNewWeek_Click:
MsgBox Err.Description
Resume Exit_CmdNewWeek_Click

Thanks for your help.

Rod (SoulBrutha23)
 
Hi!

It's hard to determine the order of what you need to do without knowing exactly what your queries are for. Given that, the command to run an action query in VBA is:

DoCmc.RunQuery "YourQuery'sName"

If the queries need to be completed prior to going to a new record, I would make a separate command button call Save records or whatever you like to run the queries from. That will also give the user the choice of continuing without saving if that is necessary.

I may be way off base here, but I hope it helps.
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top