D
dbl
Hi I am using the following to look up data in a table, how do I code it to
look in a second table (tblDownLoads) if the if formation required is not in
the first table (tblRegNumbers)?
The reason I want to have 2 tables is because the data is downloaded from 2
different sources.
Dim ExistingReg As Variant
Dim ExistingVType As Variant
Dim ExistingEmployer As Variant
Dim ExistingVMake As Variant
Dim ExistingVModel As Variant
Dim ExistingVDate As Variant
ExistingReg = DLookup("[txtRegPolicyNo]", "tblRegNumbers",
"[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVType = DLookup("[txtVehicleType]", "tblRegNumbers",
"[txtRegNo]='" & Me.Registration_Number & "'")
ExistingEmployer = DLookup("[txtRegEmployersName]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVMake = DLookup("[txtVehicleMake]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVModel = DLookup("[txtVehicleModel]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVDate = DLookup("[txtStartDate]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
If Not IsNull(ExistingReg) Then
Me.Policy_Number = ExistingReg
Me.CarCommercial = ExistingVType
Me.Employer = ExistingEmployer
Me.Make___Model_of_Car = ExistingVMake & " " &
ExistingVModel
Me.Text364 = ExistingVDate
Me.OnCoverDate = Me.Text364
Thanks Bob
look in a second table (tblDownLoads) if the if formation required is not in
the first table (tblRegNumbers)?
The reason I want to have 2 tables is because the data is downloaded from 2
different sources.
Dim ExistingReg As Variant
Dim ExistingVType As Variant
Dim ExistingEmployer As Variant
Dim ExistingVMake As Variant
Dim ExistingVModel As Variant
Dim ExistingVDate As Variant
ExistingReg = DLookup("[txtRegPolicyNo]", "tblRegNumbers",
"[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVType = DLookup("[txtVehicleType]", "tblRegNumbers",
"[txtRegNo]='" & Me.Registration_Number & "'")
ExistingEmployer = DLookup("[txtRegEmployersName]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVMake = DLookup("[txtVehicleMake]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVModel = DLookup("[txtVehicleModel]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
ExistingVDate = DLookup("[txtStartDate]",
"tblRegNumbers", "[txtRegNo]='" & Me.Registration_Number & "'")
If Not IsNull(ExistingReg) Then
Me.Policy_Number = ExistingReg
Me.CarCommercial = ExistingVType
Me.Employer = ExistingEmployer
Me.Make___Model_of_Car = ExistingVMake & " " &
ExistingVModel
Me.Text364 = ExistingVDate
Me.OnCoverDate = Me.Text364
Thanks Bob