Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.