G
'green'
Hi all,
i faced another problem again in access
i have previously create a unbound textbox form to filter the subform, with
the help of this forum.
But i was unable to create a range for the dates.
The extracted code is as follows:
Dim strFilter As String
Dim bolAnd As Boolean
bolAnd = False
strFilter = ""
If Len(Me.txtOrigin.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " Origin Like '*" & Me.txtOrigin.Value & "*'"
bolAnd = True
End If
If Len(Me.txtBookingDate.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " [Booking Date] Like '*" &
Me.txtBookingDate.Value & "*'"
bolAnd = True
End If
With Me.[Daily_Report_subform].Form
If .Dirty Then
.Dirty = False
End If
If strFilter = "" Then
.FilterOn = False 'Nothing entered: show all records.
Else
.Filter = strFilter
.FilterOn = True
End If
End With
End Sub
Code ends
How can i make a range for the "booking date", with a start date and end
date to allow user to keyed in, in order to filter the records in the
subform??? i did try those mention in this forum but i keep getting error or
missing expression...
The other problem is on the filtered form to report.
The code is created with the help of this forum but i was unable to filter
the date to the report. I think is the format problem, and i did see it in
this forum before but i lost the page could someone pls help with this?
The extracted code is shown as below:
Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click
Dim strWhere
strWhere = "1=1 "
If Not IsNull(Me.txtOrigin) Then
strWhere = strWhere & " AND [Origin] = """ & Me.txtOrigin & """"
End If
If Not IsNull(Me.txtBookingDate) Then
strWhere = strWhere & " AND [Booking Date] = """ & Me.txtBookingDate
& """"
End If
DoCmd.OpenReport "Find_Records", acPreview, , strWhere
Exit_Preview_Report_Click:
Exit Sub
Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click
End Sub
How do i change the "booking date" to allow the filter to report to be
successful???
Your help will be greatly appreciated!
Thanks
Green
i faced another problem again in access
i have previously create a unbound textbox form to filter the subform, with
the help of this forum.
But i was unable to create a range for the dates.
The extracted code is as follows:
Dim strFilter As String
Dim bolAnd As Boolean
bolAnd = False
strFilter = ""
If Len(Me.txtOrigin.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " Origin Like '*" & Me.txtOrigin.Value & "*'"
bolAnd = True
End If
If Len(Me.txtBookingDate.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " [Booking Date] Like '*" &
Me.txtBookingDate.Value & "*'"
bolAnd = True
End If
With Me.[Daily_Report_subform].Form
If .Dirty Then
.Dirty = False
End If
If strFilter = "" Then
.FilterOn = False 'Nothing entered: show all records.
Else
.Filter = strFilter
.FilterOn = True
End If
End With
End Sub
Code ends
How can i make a range for the "booking date", with a start date and end
date to allow user to keyed in, in order to filter the records in the
subform??? i did try those mention in this forum but i keep getting error or
missing expression...
The other problem is on the filtered form to report.
The code is created with the help of this forum but i was unable to filter
the date to the report. I think is the format problem, and i did see it in
this forum before but i lost the page could someone pls help with this?
The extracted code is shown as below:
Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click
Dim strWhere
strWhere = "1=1 "
If Not IsNull(Me.txtOrigin) Then
strWhere = strWhere & " AND [Origin] = """ & Me.txtOrigin & """"
End If
If Not IsNull(Me.txtBookingDate) Then
strWhere = strWhere & " AND [Booking Date] = """ & Me.txtBookingDate
& """"
End If
DoCmd.OpenReport "Find_Records", acPreview, , strWhere
Exit_Preview_Report_Click:
Exit Sub
Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click
End Sub
How do i change the "booking date" to allow the filter to report to be
successful???
Your help will be greatly appreciated!
Thanks
Green