Form Does Not Go To New Record

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a form with about 30 fields. Much of data entry for this form involves
the same data for many of the fields. To save typing time, in the form's
AfterUpdate event I run a procedure that sets the defaultvalue property of each
field to the value of that field in the last saved record. Essentially what
happens is when a record is saved it becomes the default new record in the form.
I have some comboboxes on the form that draw their data from tables that have
only one field. When I make a selection in any of these comboboxes for the
current record and then click on the new record button in the navigation
buttons, the AfterUpdate event runs fine and the default values are set.
However, the form does not go to the new record. I have to click on the new
record button a second time to move the form to the new record. When the form
moves to the new record, the default values are what they should be. I know the
procedure to change the default values runs the first time a click the new
record button because I put a MsgBox in the procedure and it pops up.

Does anyone have any ideas why the form does not go to a new record the first
time I click the new record button and does anyone have any ideas why this
behaviour occurs when values are changed in the comboboxes?

Thanks!

Steve
 
i need help from you!

How do i set the defaultvalue property of each
field to the value of that field in the last saved record.

whenever i add new record, i want one field(studentID)
copy same as previous record and rest field i can enter
myself..
 
Put the following code in the AfterUpdate event of StudentID field:

Me!StudentID.DefaultValue = """" Me!StudentID """

(That's three double quotes on each side of Me!StudentID)

Steve
 
Just a suggestion, Steve

Double-check your code to see if you missed the ".DefaultValue" bit for any
of the combos. If you actually assigned a value to the combo instead of
assigining its DefaultValue property, you would be dirtying the form again
in its AfterUpdate event, and that would stop it from moving to the new
record.
 
Back
Top