I'm hoping someone could give me some advice. I have a query that counts the number of records based on a date range selected in a form. The date format is set to short date since there is no need for the time. If for example I do a query for the range between 7/24/2013 and 7/24/2013 I should get a result of 1, but I get a message stating there are no records. If I set it to the 25th for the start and end dates I get the expected result of 1 record. Any idea why it seems to be a day off?
This is the code for the button that does the count:
Private Sub btnCountSubmittedJobs_Click()On Error GoTo btnCountSubmittedJobs_Click_ErrDim nrecords As Integer nrecords = DCount("*", "qrySubmittedJobsDateRange") If nrecords = 0 Then MsgBox "There are no jobs submitted between " & Me.StartDate & " and " & Me.EndDate & "."Else MsgBox "There have been " & nrecords & " submitted."End If On Error Resume Next btnCountSubmittedJobs_Click_Exit: Exit Sub btnCountSubmittedJobs_Click_Err: MsgBox Error$ Resume btnCountSubmittedJobs_Click_Exit End SubHere is the SQL from the query:
SELECT tblApplicationLog.ID, tblApplicationLog.[Job Title], tblApplicationLog.[Resume Sent Date], tblApplicationLog.[Company Name], tblApplicationLog.Location, tblApplicationLog.[Job Description], tblApplicationLog.ResSentFROM tblApplicationLogWHERE (((tblApplicationLog.[Resume Sent Date]) Between [Forms]![frmMain]![StartDate] And [Forms]![frmMain]![EndDate]))ORDER BY tblApplicationLog.[Resume Sent Date], tblApplicationLog.[Company Name];
↧