I am having a problem since I changed a combo box to a list box I am getting the blank result on the report. I know it’s a problem with coding, but unfortunately I could not figure it out.
Help will be appreciated.
I have attached SAMPLE DB for better understanding the problem. The FORM 1 is the form I was previously using and is working perfect.With this I select the account title, single item description and date range and I get the perfect report without any issue.
FORM 2 is the one I want to use now, as with this I cannot get the report of multiple items of an account title within specified date range. This is the one I am stuck at.
Code used on Form 1
Private Sub cmdOpenReportSingle_Click()
On Error GoTo Err_Handler
Const REPORTNAME = "Form1Report"
Const MESSAGETEXT = "Both a start and end date must be selected."
Dim strCriteria As String
Dim strDateFrom As String, strDateTo As String
' make sure a customer is selected
If Not IsNull(Me.cboDateFrom) And Not IsNull(Me.cboDateTo) Then
strDateFrom = "#" & Format(Me.cboDateFrom, "yyyy-mm-dd") & "#"
strDateTo = "#" & Format(DateAdd("d", 1, Me.cboDateTo), "yyyy-mm-dd") & "#"
' build string expression to filter report
' to selected data range
strCriteria = "PurDate >= " & strDateFrom & " And PurDate < " & strDateTo
' open report filtered to selected customer
DoCmd.OpenReport REPORTNAME, _
View:=acViewPreview, _
WhereCondition:=strCriteria
Else
MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_Here
End Sub
SAMPLE DATABASE ATTACHED
Multi Select Sample DB.zip