|
-
May 26th, 2001, 11:37 AM
#1
Thread Starter
Member
Access VB script problem
I am trying to perform a procedure which checks whether a customer in a table already exists by comparing First, Last Name and Post Code. Unfortunatly I have a probelm in the FirstName variable. This is what I have tried:
Private Sub txtPCode_AfterUpdate()
Dim FirstName As String
Dim LastName As String
Dim PCodeID As String
Dim LCustomerID As String
Dim FCustomerID As String
FistName = ""
LastName = ""
LCustomerID = ""
FCustomerID = ""
PCodeID = ""
LastName = DLookup("LName", "CustomerInfo", "LName = Forms![Add_Customer]![txtLName]")
LCustomerID = DLookup("CustID", "CustomerInfo", "[CustomerInfo]![LName] = Forms![Add_Customer]![txtLName]")
FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] = LCustomerID")
FCustomerID = DLookup("CustID", "CustomerInfo", "[CustomerInfo]![CustID] = LCustomerID")
PCode = DLookup("CustID", "CustomerInfo", "[CustomerInfo]![PCode] = Forms![Add_Customer]![txtPCode]")
If ((IsNull(FirstName) And IsNull(LastName) = False) And (FCustomerID = LCustomerID = PCodeID)) Then
MsgBox (FirstName + " " + LastName + " is an existing Customer, CustID = " + CustomerID)
Forms![Add_Customer]![txtFName] = ""
Forms![Add_Customer]![txtLName] = ""
End If
End Sub
But this did not work So I tried this: (Everything else same apart from
FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] =(DLookup("CustID", "CustomerInfo", "[CustomerInfo]![LName] = Forms![Add_Customer]![txtLName]"))")
Can anyone help me with this problem? I will be very greatful
-
May 26th, 2001, 01:37 PM
#2
Thread Starter
Member
-
May 26th, 2001, 02:07 PM
#3
PowerPoster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|