> I am inputing data via a form and often the first field (BatchNumber) is
> sequential. So i need to set the default value to the previous record +1. I
[quoted text clipped - 8 lines]
>
> JOHN
Hi !
Try use BeforeInsert event of the form
me.BatchNumber = Dmax("BatchNumber", "Table contents BatchNumber
field") + 1
Other solution: use AutoNumber for this field.
HTH
Luan
The problem is that the AfterUpdate event of a textbox only fires if you
**physically** enter data into it, i.e. type in the date or (I believe) Paste
it in. I got your code to work by adding this code in the form's Dirty event,
to force a firing of the
BatchNumber_AfterUpdate()
after the form is dirty. So when you first move to a new record, the value
for BatchNumber that shows will be the same as the previous record, but after
entering anything else in the record, it will change to be one more than the
last one. So keep your original code, and add this sub:
Private Sub Form_Dirty(Cancel As Integer)
BatchNumber_AfterUpdate
End Sub
>I am inputing data via a form and often the first field (BatchNumber) is
>sequential. So i need to set the default value to the previous record +1. I
[quoted text clipped - 8 lines]
>
>JOHN

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Jason - 28 May 2008 09:04 GMT
What about drop down lists in combo boxes - my afterupdates work fine even
if the combo box already contained the exact same text.
> The problem is that the AfterUpdate event of a textbox only fires if you
> **physically** enter data into it, i.e. type in the date or (I believe) Paste
[quoted text clipped - 24 lines]
> >
> >JOHN