Database & SQL

Moderators: None (Apply to moderate this forum)
Number of threads: 1174
Number of posts: 2221

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
need help here to prevent duplicate entry in a database! Posted by honest_dude on 23 Nov 2004 at 3:44 AM
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.

Report
Re: need help here to prevent duplicate entry in a database! Posted by Geoff-S on 23 Nov 2004 at 6:48 AM
: 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

In a World full of blind men the one-eyed man is King




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.