Manually saving a new record

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

Guest

Hi everyone,

Is there a way to programatically save a new record after one of the field
in a form has been populated?

I have a form with the following fields:
Call# (AutoNumber)
Date
Initials
A command button that opens another form based on the Call#

What I would like to happen is that after the user enters a date in the Date
field the record is saved.

Any ideas?
 
You could use the AfterUpdate event procedure of the date field to save the
record:
Private Sub CallDate_AfterUpdate()
Me.Dirty = False
End Sub

(Presumably Initials is an optional field or has a Default Value.)

BTW, Date is a reserved word in VBA (for the system date), so it will cause
you grief if you use this as a field name. I suggest you change the field
name to something else such as CallDate, and then change the name in any
queries, forms, reports as well. Before you do that, make sure the Name
AutoCorrect boxes are unchecked under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html
 
Thanks Allen. Your suggestions worked.

Allen Browne said:
You could use the AfterUpdate event procedure of the date field to save the
record:
Private Sub CallDate_AfterUpdate()
Me.Dirty = False
End Sub

(Presumably Initials is an optional field or has a Default Value.)

BTW, Date is a reserved word in VBA (for the system date), so it will cause
you grief if you use this as a field name. I suggest you change the field
name to something else such as CallDate, and then change the name in any
queries, forms, reports as well. Before you do that, make sure the Name
AutoCorrect boxes are unchecked under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html
 

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