M
medirate
I have a main form (Employees) and a subform (Accidents). They are linked by
EmployeeID.
On the subform, there is a numeric field, ClaimNumber, which I want to auto
populate. So on the After Insert property for Accidents, I have code like
this:
lngCounter = ahtGetCounter() 'get a new claim number from the
counters table and increment it
Me.ClaimNumber = lngCounter ' assign it as out claim number.
This works fine if I already have an employee in the database. But if I'm
adding a new employee, and then move to the subform to add a new accident,
the ClaimNumber field is not updated because the After Insert event is never
called (I placed a breakpoint in the After Insert but the program never
stopped).
In other words, if the employee exists in the main form, then adding a new
accident is no problem and the claimnumber field auto populates. But if the
employee does not exist in the main form then it will not work because the
code to execute the auto populate function (ahGetCounter) never gets
called.
Where should I place the code so that ClaimNumber is autopopulated?
I am using Access 2002 with an Access 2000 mdb. The ClaimNumber is always
zero until it gets a new value from the counters table.
Thanks!
EmployeeID.
On the subform, there is a numeric field, ClaimNumber, which I want to auto
populate. So on the After Insert property for Accidents, I have code like
this:
lngCounter = ahtGetCounter() 'get a new claim number from the
counters table and increment it
Me.ClaimNumber = lngCounter ' assign it as out claim number.
This works fine if I already have an employee in the database. But if I'm
adding a new employee, and then move to the subform to add a new accident,
the ClaimNumber field is not updated because the After Insert event is never
called (I placed a breakpoint in the After Insert but the program never
stopped).
In other words, if the employee exists in the main form, then adding a new
accident is no problem and the claimnumber field auto populates. But if the
employee does not exist in the main form then it will not work because the
code to execute the auto populate function (ahGetCounter) never gets
called.
Where should I place the code so that ClaimNumber is autopopulated?
I am using Access 2002 with an Access 2000 mdb. The ClaimNumber is always
zero until it gets a new value from the counters table.
Thanks!