I have the following code in the After_Update event of a field on my customer form. Each time the code runs I get a run-time error 2757, There was a problem accessing a property or method of the OLE object. When I go to debug, the Dlookup rows are the source of the errors. I use Dlookup on the same form, with the same syntax and it works fine. Any help would be greatly appreciated.
Dim frmCurrentForm As Form
Dim FormCity As String
Dim FormPostal As String
Dim LookCity As String
Dim LookPostal As String
Dim BeyondCode As Integer
'DLookup("[ProductName]", "Products", "[ProductID] =" & Forms![Order Details]!ProductID) EG
Set frmCurrentForm = Screen.ActiveForm
FormCity = frmCurrentForm.City
FormPostal = Left(frmCurrentForm.PostalCode, 3)
LookCity = DLookup("[City]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
LookPostal = DLookup("[PostalPrefix]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
BeyondCode = DLookup("[BeyondCode]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
If BeyondCode > 2 Then
Me.shippingcharges = "THIS ORDER REQUIRES ADDITIONAL SHIPPING CHARGES. PLEASE SEE KEITH FOR RATES"
Else
Me.shippingcharges = "REGULAR SHIPPING CHARGES"
End If
Dim frmCurrentForm As Form
Dim FormCity As String
Dim FormPostal As String
Dim LookCity As String
Dim LookPostal As String
Dim BeyondCode As Integer
'DLookup("[ProductName]", "Products", "[ProductID] =" & Forms![Order Details]!ProductID) EG
Set frmCurrentForm = Screen.ActiveForm
FormCity = frmCurrentForm.City
FormPostal = Left(frmCurrentForm.PostalCode, 3)
LookCity = DLookup("[City]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
LookPostal = DLookup("[PostalPrefix]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
BeyondCode = DLookup("[BeyondCode]", "SHIPPING_RATE_CHECK", "[City]=" & FormCity)
If BeyondCode > 2 Then
Me.shippingcharges = "THIS ORDER REQUIRES ADDITIONAL SHIPPING CHARGES. PLEASE SEE KEITH FOR RATES"
Else
Me.shippingcharges = "REGULAR SHIPPING CHARGES"
End If