(Msg. 25) Posted: Thu Sep 03, 2009 12:05 am
Post subject: Re: Date filter [Login to view extended thread Info.] Archived from groups: microsoft>public>access>gettingstarted (more info?)
Hi,
The field that I want to filter is called WorkDate. What worked earlier is
that when a work date was entered, the subform Schedule was filtered for that
work date. However, what I want to do is filter between a range of dates.
So I have the 2 unbound fields labelled StartDate and EndDate. I would like
the command button to filter between the dates in the above fields such that
all records that fall between the StartDate and the EndDate will appear in
the Schedule subform.
AccessVandal wrote:
>Is there a need to have a popup form after filtering the subform?
>
>Why can't you just filter them at once?
>
>I can't understand the rational of filtering sequence in this way. Can you
>tell us what are the columns/fields of the table that you want to filter?
>
>You had shown us the "WorkDate" (assumption only) which according to the code
>that will work.
>
>Am I to assume that you copied the code without editing the fields/columns to
>match your table? You must replace "SomeDate" to the field/column of your
>table. There should not be a popup "SomeDate" as Access can't find the
>field/column of the table. Can I guess "WorkDate" is the field/column, which
>is the one you wish to filter?
>
>If it is, it should look like…(in one line, watch for word wrap in your
>browser)
>
>Me.schedule.Form.Filter = "WorkDate Between #" & Me.StartDate & "# AND #" &
>Me.EndDate & "#"
>
>If you're trying to filter another field/column of the table, why no just
>combine two of them in one go. (in one single line….again watch for word wrap)
>
>Me.schedule.Form.Filter = "WorkDate Between #" & Me.StartDate & "# AND #" &
>Me.EndDate & "#" & " AND AnotherDateSomeWhere Between #" & Me.
>AnotherDateControl1 & "# AND #" & Me.AnotherDateControl2 & "#"
>
>Watch for spaces, you need to correct the syntax if necessary.
>
>Note:
>1. "AnotherDateControl" (unbound) you may need to create two more of these in
>your form.
>2. "AnotherDateSomeWhere" is the field/column name in your table. Replace it
>to the correct name.
>
>>Hi Vandal,
>>
>[quoted text clipped - 5 lines]
>>
>>Thanks!
>
(Msg. 26) Posted: Thu Sep 03, 2009 10:05 pm
Post subject: Re: Date filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Than the code I gave will work.
The filter is already searching your subform recordsource field "WorkDate"
between your input Date "StartDate and "EndDate". This is the input range of
date you wanted or is something else?
>What worked earlier is that when a work date was entered, the subform
>Schedule was filtered for that work date.
I don't understand this part, why do you need to enter this control
"WorkDate" to search/filter when you already have "StartDate" and "EndDate"
(unbound controls) and if the control "WorkDate" is already bound to the
subform's recordsource. Why are you changing the data field of "WorkDate"? Or
it's just my misunderstanding that you're using this control "WorkDate" to
filter your subform rather than the two unbound controls? Remember we can't
see your DB.
It is already filtering your "WorkDate" between the range base on your input
"StartDate" and "EndDate" so, what more do you wish to filter to?
Chris75 wrote:
>Hi,
>
>The field that I want to filter is called WorkDate. What worked earlier is
>that when a work date was entered, the subform Schedule was filtered for that
>work date. However, what I want to do is filter between a range of dates.
>So I have the 2 unbound fields labelled StartDate and EndDate. I would like
>the command button to filter between the dates in the above fields such that
>all records that fall between the StartDate and the EndDate will appear in
>the Schedule subform.
(Msg. 27) Posted: Fri Sep 04, 2009 12:05 pm
Post subject: Re: Date filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Hi,
I have my unbound fields on the main form. The command button is there as
well. The code is entered to filter records in subform labelled "Schedule".
It is possible that I inputed the code incorrectly. I entered dates into my
unbound fields (StartDate and EndDate). When I click on the button, a popup
opens asking me to enter "WorkDate". So I am guessing that somewhere along
the lines, I entered something incorrectly.
AccessVandal wrote:
>Than the code I gave will work.
>
>The filter is already searching your subform recordsource field "WorkDate"
>between your input Date "StartDate and "EndDate". This is the input range of
>date you wanted or is something else?
>
>>What worked earlier is that when a work date was entered, the subform
>>Schedule was filtered for that work date.
>
>I don't understand this part, why do you need to enter this control
>"WorkDate" to search/filter when you already have "StartDate" and "EndDate"
>(unbound controls) and if the control "WorkDate" is already bound to the
>subform's recordsource. Why are you changing the data field of "WorkDate"? Or
>it's just my misunderstanding that you're using this control "WorkDate" to
>filter your subform rather than the two unbound controls? Remember we can't
>see your DB.
>
>It is already filtering your "WorkDate" between the range base on your input
>"StartDate" and "EndDate" so, what more do you wish to filter to?
>
>>Hi,
>>
>[quoted text clipped - 5 lines]
>>all records that fall between the StartDate and the EndDate will appear in
>>the Schedule subform.
>
(Msg. 28) Posted: Fri Sep 04, 2009 12:05 pm
Post subject: Re: Date filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Hi Vandal,
Got it to work. It was an extra space that caused the issue.
Thank you!!
Chris75 wrote:
>Hi,
>
>I have my unbound fields on the main form. The command button is there as
>well. The code is entered to filter records in subform labelled "Schedule".
>It is possible that I inputed the code incorrectly. I entered dates into my
>unbound fields (StartDate and EndDate). When I click on the button, a popup
>opens asking me to enter "WorkDate". So I am guessing that somewhere along
>the lines, I entered something incorrectly.
>
>>Than the code I gave will work.
>>
>[quoted text clipped - 21 lines]
>>>all records that fall between the StartDate and the EndDate will appear in
>>>the Schedule subform.
(Msg. 29) Posted: Mon Sep 07, 2009 2:05 am
Post subject: Re: Date filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Glad to hear, Thanks for the feedback
Chris75 wrote:
>Hi Vandal,
>
>Got it to work. It was an extra space that caused the issue.
>
>Thank you!!
>
>>Hi,
>>
>[quoted text clipped - 10 lines]
>>>>all records that fall between the StartDate and the EndDate will appear in
>>>>the Schedule subform.
All times are: Eastern Time (US & Canada) (change) Goto page Previous1, 2, 3, 4
Page 4 of 4
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum