need help here to prevent duplicate entry in a database! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

need help here to prevent duplicate entry in a database!

I creat patient database which have patient ID field (text field) to enter patient No. a combination of charater and number(not an autonumber). I need a code to protect entering of a same ID when entering a new patient so that an existing patient ID should not be overwritten or there would be no same ID number.


Private sub ID_validate()

If (Eval("DLookUp(""[P_ID]"",""[rsPatient]"",""[P_ID]=frmPatient.[txtP_ID]"") Is Not Null")) Then
Beep
MsgBox "Patient ID already existed!!",
End sub

I tried this code but it doesnot work, in fact it seems the Eval and DLookUp function doesnot work at all in my program.

I would be very grateful if anyone help me in this problem.

Thank you.

Zela.

Comments

  • Geoff-SGeoff-S Posts: 82Member
    : I creat patient database which have patient ID field (text field) to enter patient No. a combination of charater and number(not an autonumber). I need a code to protect entering of a same ID when entering a new patient so that an existing patient ID should not be overwritten or there would be no same ID number.
    :
    :
    : Private sub ID_validate()
    :
    : If (Eval("DLookUp(""[P_ID]"",""[rsPatient]"",""[P_ID]=frmPatient.[txtP_ID]"") Is Not Null")) Then
    : Beep
    : MsgBox "Patient ID already existed!!",
    : End sub
    :
    : I tried this code but it doesnot work, in fact it seems the Eval and DLookUp function doesnot work at all in my program.
    :
    : I would be very grateful if anyone help me in this problem.
    :
    : Thank you.
    :
    : Zela.
    :
    :
    See Reply in Access Forum
    :-)
    [blue][b]In a World full of blind men the one-eyed man is King[/b][blue];-)

Sign In or Register to comment.