Hi all,
I am trying to add a VBA check to a TextBox object to ensure that I don't end up with duplicate records in an existing Access97 database (I can't change "Indexed" property in the table to "Yes (No Duplicates)" because the table is linked).
I have searched Tek-tips and found a bit of code by "RickSpr" in thread181-62060 that seems to do exactly what I need except it doesn't work for me (it worked for the chap he was responding to).
I get *** Run-time error '3075' - Syntax error (missing operator) in query expression 'Request Uid'. ***
This is my code:
Private Sub Request_Uid_AfterUpdate()
If Nz(Request_Uid) <> "" Then
If Not IsNull(DLookup("Request Uid", "HH Acceptances", "Request Uid = " & Request_Uid)) Then
MsgBox "Warning - Supply Request UID already exists in Database", vbInformation
End If
End If
End Sub
HH Acceptances = a table
Request Uid = a field in that table
Request_Uid = the TextBox in the form I'm working on
Please can someone help me. I have limited knowledge of Access to start with and I did not design and build the database.
Thank you in advance.
"The important thing is not to stop questioning." - Albert Einstein
I am trying to add a VBA check to a TextBox object to ensure that I don't end up with duplicate records in an existing Access97 database (I can't change "Indexed" property in the table to "Yes (No Duplicates)" because the table is linked).
I have searched Tek-tips and found a bit of code by "RickSpr" in thread181-62060 that seems to do exactly what I need except it doesn't work for me (it worked for the chap he was responding to).
I get *** Run-time error '3075' - Syntax error (missing operator) in query expression 'Request Uid'. ***
This is my code:
Private Sub Request_Uid_AfterUpdate()
If Nz(Request_Uid) <> "" Then
If Not IsNull(DLookup("Request Uid", "HH Acceptances", "Request Uid = " & Request_Uid)) Then
MsgBox "Warning - Supply Request UID already exists in Database", vbInformation
End If
End If
End Sub
HH Acceptances = a table
Request Uid = a field in that table
Request_Uid = the TextBox in the form I'm working on
Please can someone help me. I have limited knowledge of Access to start with and I did not design and build the database.
Thank you in advance.
"The important thing is not to stop questioning." - Albert Einstein