Am trying to modifying the following but am totally lost.
Private Sub cmdOpenReportSingle_Click()
On Error GoTo Err_Handler
Const REPORTNAME = "1A"
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), "mmmm") & "#"
' 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, _
MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
MsgBox Err.Description, vbExclamation, "Error"
With the above code I input dates as 19/02/2014 it works (with the Db I am using not referring to this sample 01A).
Now I made some changes in form where I use Start: Month as January With selecting Year 2014
And End Month February 2016, I am not getting the result. I think there is an issue of format & need to add Year in the code.
But I don't know how to do that.
If someone can fix or help me fix the code I will be greatful.
For better understanding I have attached Sample 01A. Please open the form DialogACDC
I would put a MSGBOX after the strCriteria = "PurDate >= " & strDateFrom & " And PurDate < " & strDateTo
msgbox(strCriteria) ' Just to checkdoes it look right
hope this help
See clear as mud
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment: Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010 VB based on my own environment: vb6 sp5 ASP based on my own environment: 5.6 VB-NET based on my own environment started 2007 SQL-2005 based on my own environment started 2008 MYLE YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.