D
dbl
Hi I have the following code that looks up data in a table and enters it
into the correct fields, the table is in the front end because there are
over one million records so it not a network issue. It takes for ever to
find the data 20-30 seconds.
I have been told that when searching large amounts of data you can code it
in such away that it will do a quick search, is this correct? and how do you
go about it?
Dim ExistingPCode As Variant
Dim ExistingSN As Variant
Dim ExistingSL As Variant
Dim ExistingTO As Variant
Dim ExistingCO As Variant
ExistingPCode = DLookup("[txtPCPostCode]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingSN = DLookup("[txtPCStreetName]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingSL = DLookup("[txtPCStreetLocation]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingTO = DLookup("[txtPCTown]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingCO = DLookup("[txtPCCounty]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
If Not IsNull(ExistingPCode) Then
Me.AddressOP = ExistingSN
Me.AddressOP1 = ExistingSL
Me.AddressOP2 = ExistingTO
Me.CountyOP = ExistingCO
End If
Thanks Bob
into the correct fields, the table is in the front end because there are
over one million records so it not a network issue. It takes for ever to
find the data 20-30 seconds.
I have been told that when searching large amounts of data you can code it
in such away that it will do a quick search, is this correct? and how do you
go about it?
Dim ExistingPCode As Variant
Dim ExistingSN As Variant
Dim ExistingSL As Variant
Dim ExistingTO As Variant
Dim ExistingCO As Variant
ExistingPCode = DLookup("[txtPCPostCode]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingSN = DLookup("[txtPCStreetName]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingSL = DLookup("[txtPCStreetLocation]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingTO = DLookup("[txtPCTown]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
ExistingCO = DLookup("[txtPCCounty]", "tblPostCode",
"[txtPCPostCode]='" & Me.PostcodeOP & "'")
If Not IsNull(ExistingPCode) Then
Me.AddressOP = ExistingSN
Me.AddressOP1 = ExistingSL
Me.AddressOP2 = ExistingTO
Me.CountyOP = ExistingCO
End If
Thanks Bob