Adam McReynolds
Registered User.
- Local time
- Yesterday, 23:04
- Joined
- Aug 6, 2012
- Messages
- 129
I need help to get this syntax right. I have something similar that worked before to open a report but now I am using the same code structure on opening a form and I can't get it.
[prikey] is an autonumber and that has given me trouble before with the syntax. [EstimateFlagCleared] and [WarrantyFlagCleared] are Yes/No fields.
Any help would be much appreciated.
[prikey] is an autonumber and that has given me trouble before with the syntax. [EstimateFlagCleared] and [WarrantyFlagCleared] are Yes/No fields.
Dim maxFlag As String
Dim flagCriteriaWarranty As String
Dim flagCriteriaEstimate As String
Dim strWhere As String
Dim verifyWarrnty As String
Dim priceAdjustment As String
Dim noStatement As String
verifyWarranty = "Verify Warranty"
priceAdjustment = "Price Adjustment"
noStatement = "No"
flagCriteriaWarranty = "WarrantyStatusFlag = '" & verifyWarranty & "' And WarrantyFlagCleared = '" & noStatement & "'"
flagCriteriaEstimate = "EstimateFlag = '" & priceAdjustment & "' And EstimateFlagCleared = '" & noStatement & "'"
strWhere = " & flagCriteriaWarranty & " Or " & flagCriteriaEstimate & "
maxFlag = DMax("prikey", "tbl_module_repairs", strWhere)
If maxFlag > 0 Then
DoCmd.OpenForm "FRM_RF_FLAG_MAIN", acNormal, , "prikey = " & maxFlag & ""
Else
MsgBox "Contact the Database Administrator"
End If
Any help would be much appreciated.