Form_Date does not work

Z

znibk

I have a form on which I created unbound txt boxes. I have tried

using two unbound txt boxes, putting startdate in one and enddate in the
other; then tried txtstart; txtend;
Then from a post, which I can not find back, I entered the following two
expressions, each one in an unbound txt box
=" From " & [Start_Date] & " To " & [End_Date] and the other
=" From " & Format([StartDate],"Medium Date") & " To " &
Format([EndDate],"Medium Date")

Then, since I always phrase my query parameter to Between [Enter Start Date]
And [Enter End Date], i tried
="Between " & [Enter Start Date] & " And " & [Enter End Date]

With each of the expressions I've tried, I receive the #Name? error.

Also, since the whole concept of having a form as a filter for a report is
new to me, is the only thing I must do to the report/sub reports is enter the
name of the form_Date under the Filter property and set the Filter to "yes?"

I really hope someone knows what I am doing wrong with these and how to
help me? As always, any help would be greatly appreciated. k
 
T

tina

it's not quite clear how you're trying to set this up; but i think you want
two unbound textbox controls on the form, in which the user can enter Start
and End dates to be used a criteria in a query that is bound to a
report...correct? and you're going to preview or print the report while the
form is open, correct?

if so, you only need two textbox controls on the form, such as
txtStart
txtEnd

those extra calculated controls that you mentioned are not necessary.

then, in the query underlying the report, add criteria to the date field, as

Between Forms!FormName!txtStart And Forms!FormName!txtEnd

the above goes all on one line in the query criteria, regardless of linewrap
in this post. replace FormName with the correct name of the form, of course.
then, while still in query Design view, from the menu bar click Query |
Parameters. in the Query Parameters box, enter the parameters and the data
type in the columns, as

Forms!FormName!txtStart Date/Time
Forms!FormName!txtEnd Date/Time

again, taking care to use the correct form name.

now all you have to do is enter two valid dates in the form controls, and
preview/print the report, while the form is still open.

hth
 
J

justme0010

Just to verify, is your form bound to those date fields? i.e., in
View,Field List you see StartDate and EndDate listed? Also, why is one
of your examples using the underscore character in the field names and
the other is not? Are these two sets of different fields?
 
Z

znibk

Tina,

Thanks for replying on Labor Day. However, I had some problems.

I opened a form; in two unbound text boxes, I put in one, txtStart; in the
other, txtEnd. Being sure that would work, I did not try it. I proceeded to
your

step 2) I hope I did this right, I clicked on the Query Builder (the three
dots) beside the query Reccord Source for my Report. I copied and pasted,
edited with my form's name, on the Criteria line under my date field. Between
[Forms]![frmDates]![txtStart] And [Forms]![frmDates]![txtEnd] (Access
automatically put the brackets)

Step 3) While in query mode, on the Menu Bar, I clicked Query Parameters,
and entered
Forms!frmDates!txtStart Date/Time
Forms!frmDates!txtEnd Date/Time

Mind you, I tripled and quadrupled checked as I did what you said. Thinking
I'm ready to go, I opened the form, and I have the #Name? error. I try to
open the report anyway, and it tells me I have Invalid bracketing of
'[Forms!frmDates!txtStart]' So, I copied and pasted everything you have in
your instructions and tried again. The brackets automatically surround the
field names. I close, try to run and get the same error.

Any suggestions as to what I am doing wrong?

Christ's blessings,
k


tina said:
it's not quite clear how you're trying to set this up; but i think you want
two unbound textbox controls on the form, in which the user can enter Start
and End dates to be used a criteria in a query that is bound to a
report...correct? and you're going to preview or print the report while the
form is open, correct?

if so, you only need two textbox controls on the form, such as
txtStart
txtEnd

those extra calculated controls that you mentioned are not necessary.

then, in the query underlying the report, add criteria to the date field, as

Between Forms!FormName!txtStart And Forms!FormName!txtEnd

the above goes all on one line in the query criteria, regardless of linewrap
in this post. replace FormName with the correct name of the form, of course.
then, while still in query Design view, from the menu bar click Query |
Parameters. in the Query Parameters box, enter the parameters and the data
type in the columns, as

Forms!FormName!txtStart Date/Time
Forms!FormName!txtEnd Date/Time

again, taking care to use the correct form name.

now all you have to do is enter two valid dates in the form controls, and
preview/print the report, while the form is still open.

hth


znibk said:
I have a form on which I created unbound txt boxes. I have tried

using two unbound txt boxes, putting startdate in one and enddate in the
other; then tried txtstart; txtend;
Then from a post, which I can not find back, I entered the following two
expressions, each one in an unbound txt box
=" From " & [Start_Date] & " To " & [End_Date] and the other
=" From " & Format([StartDate],"Medium Date") & " To " &
Format([EndDate],"Medium Date")

Then, since I always phrase my query parameter to Between [Enter Start Date]
And [Enter End Date], i tried
="Between " & [Enter Start Date] & " And " & [Enter End Date]

With each of the expressions I've tried, I receive the #Name? error.

Also, since the whole concept of having a form as a filter for a report is
new to me, is the only thing I must do to the report/sub reports is enter the
name of the form_Date under the Filter property and set the Filter to "yes?"

I really hope someone knows what I am doing wrong with these and how to
help me? As always, any help would be greatly appreciated. k
 
Z

znibk

Justme0010,

Hello. Yes, my form, query, and report are bound to these date fields. The
actual field I am using to obtain my start date and my end date is the date
the check was written, ie ACkDate. Also, I would like the date range to
appear in the Medium Date format in the header of my report so it would look
more professional in the title of than 7/1/07 to 7/31/07.

When I just set the criteria in my query (as I was shown to do in all the
Access text books and classes I've taken) as Between [Enter Start Date] And
[Enter End Date], my report runs perfectly.

However, I developed a report that asked me 101 times for my parameters and
was told by D.H. that I was never ever to set parameters in queries unless I
wanted unpleasant results. I was to set them in a form. Since then, the first
of August, I have been trying to learn how to do it. I keep having similar
problems as I posted in my reply to Tina.

To answer your second question, the underscore was put between the
Start_Date because that was the way it was put in one of the examples I found
in a post (I apologize, I can not find the name of the post) It caught my eye
as one of the suggestions was how to format the date range to medium date.

Hope I gave only the correct amount of information and you can help me out;
I'll check tomorrow. Good night, and

Christ's blessings,
k
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top