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

Code for Save/commit new record? 1

Status
Not open for further replies.

JimSchuuz

IS-IT--Management
Jan 24, 2005
45
0
0
US
I searched for this term and didn't find anything, but I might be phrasing it wrong also.

I'm looking for the code (primarily for a command button) that saves the information entered in the current form to the DB/table as a new record without the user being forced to close the form and reopen it, or without forcing them to click the button for a new record, then returning to the particular record.

I hope I'm being clear about the steps. The purpose for this is to let the user perform other tasks with this record without having to do the extra steps of closing & reopening, or clicking "new record" and then going back one.

Any help?

Jim Schuuz
{ F1 = my.friend
}
 
Is this a bound or unbound form? If the form is bound the default is that the data is saved, but from you question, there would appear to be some other complication. It is also possible to use RunCommand:

[tt]DoCmd.RunCommand accmdSaveRecord[/tt]
 
First I'd like to say that your answer worked beautifully.

In reply to your question, the form for record entry is bound to the only table in the DB. After entering data in the fields, a cmdButton opens a second form that should have certain fields populated with the info from the new record, except that simply entering them in the first form displays blank fields in the second, unless the first record isomehow saved first.

I will try to verify that the form is bound to the table correctly or that I made a mistake in this instance, but regardless your answer works perfectly for me! thank you

Jim Schuuz
{ F1 = my.friend
}
 
Just to add (for anyone with a similar problem) I found another solution.

If I add a new command button with the wizard enabled, it gives me the option to "Save Current Record" whereby I can add additional commands after to the onclick function.

Sorry for troubling everyone over a stupid oversight on my part.

Jim Schuuz
{ F1 = my.friend
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top