Save a record without closing the form?

AccessMc

Registered User.
Local time
Today, 04:40
Joined
Apr 3, 2011
Messages
25
I need to perform queries on data inside a form against the table the form enters data into. So, I need the data in the Stock table that the form is a data entry form in, without closing the form.

Is there any way to save a record through a Macro without closing the Form?
I need to use a Macro because the save button goes on to call multiple queries and then to delete a table and open a report.

Thankyou in advance.
 
In code:

DoCmd.RunCommand acCmdSaveRecord
or
If Me.Dirty Then Me.Dirty = False

In a macro you could use the RunCommand action.
 
Thankyou very much for your reply, but I have managed to solve this a slightly different way.

Solution:
When opening a form in Add mode, only one record exists in it, so you can't use goto record next/previous. Instead in the Macro use goto record new, gotorecord previous. That saves it and ensures the input information is still available to queries.

Mod note: If you think this thread would be useful to others and my title could be improved for SEO reasons, please feel free to change it.
 
Using pbaldy solution is much cleaner.

Also if it is a multiuser database (lets say invoice), you should execute

If Me.Dirty Then Me.Dirty = False

as soon as the invoice number gets populated so if some other uses uses the same form it doesnt get the same InvoiceID.
 

Users who are viewing this thread

Back
Top Bottom