New patient record

D

davethewelder

Hi, I am trying to create a unique sequential number for adding patients to a
table. I have tried the code below but it does not update field
"PatientNumber". I am trying to avoid using an autonumber as an identity
number.


Private Sub PatientNumber_BeforeUpdate(Cancel As Integer)
PatientNumber = Nz(DMax("Patientnumber", "PATIENT TABLE"), 0) + 1
End Sub

I must be missing something. Any ideas?

Any help greatly appreciated.

Davie
 
L

Linq Adams via AccessMonster.com

PatientNumber_BeforeUpdate won't fire unless you physically enter data into
the PatientNumber textbox, and that's what you're trying to automate!

This kind of code needs to be in the Form_BeforeUpdate event.
 

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