Save and append

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form that creates a new record every time it is run. I then need to
take the record ID and use it for an append operation. For this purpose, I
have created a Save Record button to which I attached a macro to the On Mouse
Up event to run my append query.
However, the first time I press the button the query wants to append only 0
records. It takes a second click for it to work.
I guess that's because the save operation is not run before the query.

Can I do both operations in VB in a way that one will run after the other?
Or should I just use the macro to save the table and then run the query?

Thank you.
 
I have found a solution to this problem with the answer to a different
question. This is an event procedure that's run On Click when I press a
button:

Dim stDocName As String
stDocName = "Macro1"

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunMacro stDocName
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Works like a charm the first time now.
 

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

Back
Top