G
Guest
I'm having trouble getting this code to work.
I get the following error "Data type mismatch in criteria
expression" I know the error is created during the
dlookup operation. The data type
for "OutsideCityLimitsTaxRate"
and "InsideCityLimitsTaxRate" is currency with a standard
format. The data type for "ZipCode" and "PostalCode" is
text.
Here is the code I have so far:
Private Sub Command69_Click()
On Error GoTo Err_Command69_Click
Dim strCriteria As String
Dim strField As String
Dim curTaxRate As Currency
Rem DoCmd.RunCommand acCmdSaveRecord
If chkInsideCityLimits Then
strField = "InsideCityLimitsTaxRate"
Else
strField = "OutsideCityLimitsTaxRate"
End If
strCriteria = "ZipCode=" & [PostalCode]
curTaxRate = DLookup(strField, "Table_Tax_Rate",
strCriteria)
[Sales Tax Rate] = curTaxRate
Me.Refresh
MsgBox "Tax Information was updated."
Exit_Command69_Click:
Exit Sub
Err_Command69_Click:
MsgBox Err.Description
Resume Exit_Command69_Click
End Sub
Thanks for you help and time
Jason Frazer
I get the following error "Data type mismatch in criteria
expression" I know the error is created during the
dlookup operation. The data type
for "OutsideCityLimitsTaxRate"
and "InsideCityLimitsTaxRate" is currency with a standard
format. The data type for "ZipCode" and "PostalCode" is
text.
Here is the code I have so far:
Private Sub Command69_Click()
On Error GoTo Err_Command69_Click
Dim strCriteria As String
Dim strField As String
Dim curTaxRate As Currency
Rem DoCmd.RunCommand acCmdSaveRecord
If chkInsideCityLimits Then
strField = "InsideCityLimitsTaxRate"
Else
strField = "OutsideCityLimitsTaxRate"
End If
strCriteria = "ZipCode=" & [PostalCode]
curTaxRate = DLookup(strField, "Table_Tax_Rate",
strCriteria)
[Sales Tax Rate] = curTaxRate
Me.Refresh
MsgBox "Tax Information was updated."
Exit_Command69_Click:
Exit Sub
Err_Command69_Click:
MsgBox Err.Description
Resume Exit_Command69_Click
End Sub
Thanks for you help and time
Jason Frazer