Bob, this is all of my query and after this I have copied and pasted Visual Basics codes from my date picker form and if this doesn't help, I will send my database up to my web space this evening and you can review it:
Query:
SELECT [Accrual Table].[Vendor Name], [Accrual Table].[PO No], [Accrual Table].[Account Code], [Accrual Table].[Date Received], [Accrual Table].[AES Item No], [Accrual Table].[Purchase Order Description], [Accrual Table].[Cost Center], [Accrual Table].[Receive To ID], [Accrual Table].[Qty Received (UOP)], [Accrual Table].[Original Unit Cost], [Accrual Table]![Qty Received (UOP)]*[Accrual Table]![Original Unit Cost] AS [Received Total], [Accrual Table].[Item Total], [Item Total]-[Received Total] AS [Amount Not Received]
FROM [Accrual Table];
Visual Basics:
Private Sub cboStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Set cboOriginator = cboStartDate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub
Private Sub ocxCalendar_Click()
cboOriginator.Value = ocxCalendar.Value
cboOriginator.SetFocus
ocxCalendar.Visible = False
Set cboOriginator = Nothing
End Sub
Private Sub OK_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "End Of Month Accrual"
strField = "Received Date"
If IsNull(Me.cboStartDate) Then
If Not IsNull(Me.cboEndDate) Then 'End date, but no start.
strWhere = strField & " < " & Format(Me.cboEndDate, conDateFormat)
End If
Else
If IsNull(Me.cboStartDate) Then 'Start date, but no End.
strWhere = strField & " > " & Format(Me.cboStartDate, conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.cboStartDate, conDateFormat) _
& " And " & Format(Me.cboEndDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub
Private Sub Printer_Button_Click()
On Error GoTo Err_Printer_Button_Click
Dim stDocName As String 'Name of report to print.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
stDocName = "End Of Month Accrual"
strField = "Received Date"
If IsNull(Me.cboStartDate) Then
If Not IsNull(Me.cboEndDate) Then 'End date, but no start.
strWhere = strField & " < " & Format(Me.cboEndDate, conDateFormat)
End If
Else
If IsNull(Me.cboStartDate) Then 'Start date, but no End.
strWhere = strField & " > " & Format(Me.cboStartDate, conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.cboStartDate, conDateFormat) _
& " And " & Format(Me.cboEndDate, conDateFormat)
End If
End If
DoCmd.OpenReport stDocName, acNormal, , strWhere
Exit_Printer_Button_Click:
Exit Sub
Err_Printer_Button_Click:
MsgBox Err.Description
Resume Exit_Printer_Button_Click
End Sub