G
Guest
Is this possible?
On My form I have several fields which are.
CompanyName
BillingAddress
City
State
Zipcode
Let me use BassPro Shop for example: They have a chain of stores in
different cities with different billing addresses. I can't have it Indexed
for no duplicates in my Table for addresses because if one of there stores
Street address is 3201 e hwy 6 Located in Hammond In and John Doe's Street
address is the same for Chicogo.
I need some vb code that will check Company Name, BillingAddress, City and
State
The reason is that it is possible to have the same mailing address in two
different city or States and This way I know without a doubt that there is or
is not any duplicates before update. I have the following code so far but it
isn't working. The debug keeps Highlighting "Me.Bookmark = rsc.Bookmark" in
my code
-------- My Code----------
Private Sub BillingAddress_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.BillingAddress.Value
stLinkCriteria = "[BillingAddress]=" & "'" & SID & "'"
If Not IsNull(DLookup("CustomerID", "Customers", "BillingAddress")) Then
Cancel = (MsgBox("Do You Want To Proceed?", vbQuestion + vbYesNo) = vbNo)
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
------------------end Code---------------------
Thanks for any help in advance
Alvin
On My form I have several fields which are.
CompanyName
BillingAddress
City
State
Zipcode
Let me use BassPro Shop for example: They have a chain of stores in
different cities with different billing addresses. I can't have it Indexed
for no duplicates in my Table for addresses because if one of there stores
Street address is 3201 e hwy 6 Located in Hammond In and John Doe's Street
address is the same for Chicogo.
I need some vb code that will check Company Name, BillingAddress, City and
State
The reason is that it is possible to have the same mailing address in two
different city or States and This way I know without a doubt that there is or
is not any duplicates before update. I have the following code so far but it
isn't working. The debug keeps Highlighting "Me.Bookmark = rsc.Bookmark" in
my code
-------- My Code----------
Private Sub BillingAddress_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.BillingAddress.Value
stLinkCriteria = "[BillingAddress]=" & "'" & SID & "'"
If Not IsNull(DLookup("CustomerID", "Customers", "BillingAddress")) Then
Cancel = (MsgBox("Do You Want To Proceed?", vbQuestion + vbYesNo) = vbNo)
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
------------------end Code---------------------
Thanks for any help in advance
Alvin