J
Jason Frazer
I have a macro that uses the dlookup command to look up
tax rate and juristiction code. Can i use more that one
Criteria in the dlookuo command. You can see the 3
criteria I have set below.
Thanks for your help
Jason Frazer
Private Sub Command69_Click()
On Error GoTo Err_Command69_Click
Dim strCriteria As String
Dim strTaxField As String
Dim strJurField As String
Dim JurCode As String
Dim Cnty As String
Dim curTaxRate As Currency
Dim cosTaxRate As Currency
Dim chkInsideCityLimits As Variant
Dim strShipCityField As String
Dim strCountyField As String
Rem DoCmd.RunCommand acCmdSaveRecord
cosTaxRate = [Customer Sales Tax Rate]
strShipCityField = [Ship City]
strCountyField = [County]
chkInsideCityLimits = [InsideCityLimits]
If chkInsideCityLimits Then
strTaxField = "InsideCityLimitsTaxRate"
strJurField = "InsideCityLimitsJurisdictionCode"
Else
strTaxField = "OutsideCityLimitsTaxRate"
strJurField = "OutsideCityLimitsJurisdictionCode"
End If
strCriteria1 = "ZipCode='" & [PostalCode] & " " & "'"
strCriteria2 = "City='" & [Ship City] & " " & "'"
strCriteria3 = "County='" & [County] & " " & "'"
curTaxRate = DLookup(strTaxField, "Table_Tax_Rate",
strCriteria)
JurCode = DLookup(strJurField, "Table_Tax_Rate",
strCriteria)
Cnty = DLookup("County", "Table_Tax_Rate", strCriteria)
If cosTaxRate <> curTaxRate Then
MsgBox "Customer Tax does not equal State assigned tax
CLARIFICATION NEEDED!"
End If
[Sales Tax Rate] = curTaxRate
[JurisdictionCode] = JurCode
[County] = Cnty
Me.Refresh
MsgBox "Tax Information was updated."
Exit_Command69_Click:
Exit Sub
Err_Command69_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command69_Click
End Sub
tax rate and juristiction code. Can i use more that one
Criteria in the dlookuo command. You can see the 3
criteria I have set below.
Thanks for your help
Jason Frazer
Private Sub Command69_Click()
On Error GoTo Err_Command69_Click
Dim strCriteria As String
Dim strTaxField As String
Dim strJurField As String
Dim JurCode As String
Dim Cnty As String
Dim curTaxRate As Currency
Dim cosTaxRate As Currency
Dim chkInsideCityLimits As Variant
Dim strShipCityField As String
Dim strCountyField As String
Rem DoCmd.RunCommand acCmdSaveRecord
cosTaxRate = [Customer Sales Tax Rate]
strShipCityField = [Ship City]
strCountyField = [County]
chkInsideCityLimits = [InsideCityLimits]
If chkInsideCityLimits Then
strTaxField = "InsideCityLimitsTaxRate"
strJurField = "InsideCityLimitsJurisdictionCode"
Else
strTaxField = "OutsideCityLimitsTaxRate"
strJurField = "OutsideCityLimitsJurisdictionCode"
End If
strCriteria1 = "ZipCode='" & [PostalCode] & " " & "'"
strCriteria2 = "City='" & [Ship City] & " " & "'"
strCriteria3 = "County='" & [County] & " " & "'"
curTaxRate = DLookup(strTaxField, "Table_Tax_Rate",
strCriteria)
JurCode = DLookup(strJurField, "Table_Tax_Rate",
strCriteria)
Cnty = DLookup("County", "Table_Tax_Rate", strCriteria)
If cosTaxRate <> curTaxRate Then
MsgBox "Customer Tax does not equal State assigned tax
CLARIFICATION NEEDED!"
End If
[Sales Tax Rate] = curTaxRate
[JurisdictionCode] = JurCode
[County] = Cnty
Me.Refresh
MsgBox "Tax Information was updated."
Exit_Command69_Click:
Exit Sub
Err_Command69_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command69_Click
End Sub