hardhitter06
Registered User.
- Local time
- Today, 12:32
- Joined
- Dec 21, 2006
- Messages
- 600
Hi All,
Access 2003.
I have an Input form that stores a new "VendorName" and "VendorFedID". I later use this table to select the Vendor on a different form and attach a W9 file.
On the first input form adding a vendor (with fed id), if I add a Vendor's name with an Apostrophe somewhere in the field, I get an Acces Halt-Debug error.
Here is my code for this Vendor Field:
The line in yellow is where the error is taking place. Is there a way to allow apostrophes?
Thank you in advance,
Josh
Access 2003.
I have an Input form that stores a new "VendorName" and "VendorFedID". I later use this table to select the Vendor on a different form and attach a W9 file.
On the first input form adding a vendor (with fed id), if I add a Vendor's name with an Apostrophe somewhere in the field, I get an Acces Halt-Debug error.
Here is my code for this Vendor Field:
Code:
Private Sub VendorName_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
[B][COLOR="Red"][COLOR="Yellow"] Answer = DLookup("[VendorName]", "tblInputNewVendor", "[VendorName] = '" & Me.VendorName & "'")[/COLOR][/COLOR]
If Not IsNull(Answer)[/B] Then
MsgBox "Duplicate Vendor Name Found." & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True
Me.VendorName.Undo
Else:
End If
End Sub
The line in yellow is where the error is taking place. Is there a way to allow apostrophes?
Thank you in advance,
Josh