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
 
Back
Top