Persistent variable?

M

Mike from Moriches

?Greetings-
I enter many records with the same date. I prefer not to enter the date
over and over. My previous database had a "ditto" function that would
populate a field with the datum from the previous record, but allow me to
change it when I moved on to the next date. What is the best way to do this
in an Access 2007 form?
Thanks,
Mike from Moriches
 
D

Douglas J. Steele

One way is to set the DefaultValue of the control on your form. By doing so
in the control's AfterUpdate event, you get the ability to change the value
and have that change persist

Private Sub MyControl_AfterUpdate()

Me!MyControl.DefaultValue = Chr$(34) & Me!MyControl.Value & Chr$(34)

End Sub

(replace MyControl with your actual control name)
 

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