Greeting,
I'm trying to launch an OpenForm function with a double criteria. I
can't seem to make them work together, the two criteria work seperatly
so I assume my code to synchronise both together isn't working.
The idea is to open a form that will sum sales per month. I wish to
have the form filtered on open by year and by currency.
Here's my code:
Private Sub Commande13_Click()
Dim stDocName, var1, var2 As String
Dim stLinkCriteria As String
If IsNull(Me.Combo1) Or Me.Combo1 = "" Then
var1 = " "
Else
var1 = "CAPYear=" & Me.Combo1
End If
If IsNull(Me.Combo2) Or Me.Combo2 = "" Then
var2 = " "
Else
var2 = "CAPCurrency=" & "'" & Me.Combo2 & "'"
End If
stLinkCriteria = var1 + var2
' (I've tried using AND instead but I get an incompatibility error,
probably numeric VS Text)
stDocName = "FRM_MonthSales"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Commande13_Click:
Exit Sub
Err_Commande13_Click:
MsgBox Err.Description
Resume Exit_Commande13_Click
End Sub
Thank for all the help!!!