Have done as you suggested and the same problem still arises. In the Immediate Window it just comes up with whatever I had entered. For example:
Hospital_Number = 'RTRTRTRTRT'
It even still generates the MsgBox when I input punctuation which is never normally included in any patient's hospital_number . I wanted to make sure it wasn't because every individual digit/letter had appeared in a hospital number at some point.
User Profile
Collapse
-
Thank you Seth, that prevented the error message but the same problem still applies in that every time I enter ANYTHING in for hospital_number (text field) it generates the message box that is only supposed to warn you if a duplicate already exists. Any ideas? The code as it stands is as follows:
...Code:Private Sub Hospital_Number_BeforeUpdate(Cancel As Integer) If DCount("Hospital_Number", "Voc Rehab DB",Leave a comment:
-
I removed the .Text as suggested as well as trying removing the Nz() function. However, removing the latter bracket led to an error code stating it expected a "Then or a Go To Statement". Removing the earlier end bracket was allowed but then returned the error: "Compile Error: Wrong number of arguments or Invalid Property Assignment".
This is now the code:
...Code:Private Sub Hospital_Number_BeforeUpdate(Cancel
Leave a comment:
-
Once again, sorry, I need to be clearer!
Every time a number is entered it delivers the MsgBox containing "The value you are adding already exists, do you want to continue?".
This pops up even when you are entering a completely new hospital number and not a duplicate.Leave a comment:
-
Sorry, yes, the code causes it to come up with an error message whatever is entered into the textbox. Even if there isn't an existing duplicate for that particular hospital number.Leave a comment:
-
Duplicate Entry Warning Message
I'm trying to get a duplicate entry into a textbox flagged as a before_update warning message. The field is "Hospital_Numbe r" within the table "Voc Rehab DB". The Hospital Number is a text field since hospital numbers can include things like: U/G39401
At the moment I have the following code:
...Code:Private Sub Hospital_Number_BeforeUpdate(Cancel As Integer) If Nz(DCount("Hospital_Number",Last edited by Rabbit; Aug 21 '15, 05:52 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
No activity results to display
Show More
Leave a comment: