How to send form data to tables programatically

M

markmarko

Is there a way to programatically have a form update to the underlying tables?

What I mean is... As a user types into a form, Access doesn't seem to
actually send that data to the table (and thereby create autonumbers) until
user moves on to another record.

Is there a way to force that data to the tables (ie make the new records)
while the user is still on the form?
 
J

John W. Vinson

Is there a way to programatically have a form update to the underlying tables?

What I mean is... As a user types into a form, Access doesn't seem to
actually send that data to the table (and thereby create autonumbers) until
user moves on to another record.

Is there a way to force that data to the tables (ie make the new records)
while the user is still on the form?

Yes. Use the AfterUpdate event of one or more of the controls to force a write
to disk. Either

Private Sub controlname_AfterUpdate(Cancel as Integer)
DoCmd.RunCommand acCmdSaveRecord
End Sub

or

Private Sub controlname_AfterUpdate(Cancel as Integer)
If Me.Dirty Then Me.Dirty = False
End Sub


John W. Vinson [MVP]
 
M

markmarko

Thank you, that did the trick...

I wonder where one finds this info? I searched Microsofts online Access help
for 'acCmdSaveRecord ' and found nothing. How does one learn the various
commands?
 

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

Top