L
Leonard Priestley
I am designing a form which should enable the user to select records
according to a specified date, or date window.
So far I have managed to limit the recordset to dates before a date
specified in a textbox called txtFromDate. I used the code:
Me.RecordSource = "SELECT tblDiscussion.Action, tblDiscussion.ActionDate _
FROM tblDiscussion _
WHERE (((tblDiscussion.Action) Is Not Null) AND ((tblDiscussion.ActionDate)
Is Not Null)) AND tblDiscussion.ActionDate < #" & Format(txtFromDate,
"YYYY/MM/DD") & "#" & " _
ORDER BY tblDiscussion.ActionDate"
The code I used looks the way it does because I live in New Zealand, where
dates are in the dd/mm/yyyy format, and the code "tblTable.Field = #" &
txtFromDate & "#" only seems to work reliably with US style dates.
My problem is that I would now like to extend the process, to specify both
an earlier and later date, using textboxes txtFromDate and txtToDate.
At this point, I have got bogged down in the syntax. I have spent hours
attempting to get it right, but I am no expert and the learning curve is
steep. What I have so far is:
Me.RecordSource = "SELECT tblDiscussion.Action, tblDiscussion.ActionDate _
FROM tblDiscussion _
WHERE (((tblDiscussion.Action) Is Not Null) AND ((tblDiscussion.ActionDate)
Is Not Null)) AND (tblDiscussion.ActionDate < #" & Format(txtFromDate,
"YYYY/MM/DD") & "#") & "AND (tblDiscussion.ActionDate > #" &
Format(txtToDate, "YYYY/MM/DD") & "#" & "ORDER BY tblDiscussion.ActionDate"
Any help gratefully received.
Failing that Aspirin would be acceptable
Leonard Priestley
according to a specified date, or date window.
So far I have managed to limit the recordset to dates before a date
specified in a textbox called txtFromDate. I used the code:
Me.RecordSource = "SELECT tblDiscussion.Action, tblDiscussion.ActionDate _
FROM tblDiscussion _
WHERE (((tblDiscussion.Action) Is Not Null) AND ((tblDiscussion.ActionDate)
Is Not Null)) AND tblDiscussion.ActionDate < #" & Format(txtFromDate,
"YYYY/MM/DD") & "#" & " _
ORDER BY tblDiscussion.ActionDate"
The code I used looks the way it does because I live in New Zealand, where
dates are in the dd/mm/yyyy format, and the code "tblTable.Field = #" &
txtFromDate & "#" only seems to work reliably with US style dates.
My problem is that I would now like to extend the process, to specify both
an earlier and later date, using textboxes txtFromDate and txtToDate.
At this point, I have got bogged down in the syntax. I have spent hours
attempting to get it right, but I am no expert and the learning curve is
steep. What I have so far is:
Me.RecordSource = "SELECT tblDiscussion.Action, tblDiscussion.ActionDate _
FROM tblDiscussion _
WHERE (((tblDiscussion.Action) Is Not Null) AND ((tblDiscussion.ActionDate)
Is Not Null)) AND (tblDiscussion.ActionDate < #" & Format(txtFromDate,
"YYYY/MM/DD") & "#") & "AND (tblDiscussion.ActionDate > #" &
Format(txtToDate, "YYYY/MM/DD") & "#" & "ORDER BY tblDiscussion.ActionDate"
Any help gratefully received.
Failing that Aspirin would be acceptable
Leonard Priestley