I still get a Type mismatch (Error 13) I also added dim strWhere4 as
Date also tried as string
I don't get it
Here is code
Dim strSQLE As String
Dim strSQLy As String
Dim sWhere As String
Dim strWhere4 As Date
Dim varSelected As Variant
'Select from List Box if it is base on the PUB field PubNumber
For Each varSelected In Me!list.ItemsSelected
strSQL = strSQL & Me!list.ItemData(varSelected) & ","
Next varSelected
If strSQL <> "" Then
End If
strSQL = "[Pub] IN (" & Left(strSQL, Len(strSQL) - 1) & ")"
Select Case Forms!reportCriteriaAccounting!lstReports.Value
Case "rptAccoutingPublicationBalance_Acc"
DoCmd.OpenReport
"rptAccoutingPublicationBalance_Acc", acPreview, , strSQL
DoCmd.Maximize
Case "AR Aging Report_Acc"
DoCmd.OpenReport "AR Aging Report_Acc", acPreview,
, strSQL
DoCmd.Maximize
Case "QryOutstanding_Acc"
DoCmd.OpenReport "QryOutstanding_Acc", acPreview, ,
strSQL
DoCmd.Maximize
Case "QryBalance_Acc"
DoCmd.OpenReport "QryBalance_Acc", acPreview, ,
strSQL
DoCmd.RunCommand acCmdFitToWindow
Case "SalesCommission_Acc"
DoCmd.OpenReport "SalesCommission_Acc", acPreview,
, strSQL
DoCmd.Maximize
Case "RevenueRec_Acc"
strWhere4 = "[PaymentDate] >= #" &
CDate(Nz(Me!txtDatefrom, Date)) & _
"# And [PaymentDate] <= #" &
CDate(Nz(Me!txtDateTo, Date)) & "#"
DoCmd.OpenReport "RevenueRec_Acc", acPreview, , strWhere4
' DoCmd.RunCommand acCmdFitToWindow
End Select
End Sub
At this moment I am asking only for dates fields(strWHERE)
I will need to add this values to a second string later base on a
number field. (strSQL=StrSQL & StrWhere4)
I have try this already with 2 number filed and it works
Your Help is greatly appreciated