Creating a form

G

Guest

I want to create a form based on a query that has an Award field. I need the
user to enter a start date and end date in that form. The result in the form
will be all projects whose award date is between the start and end date.

I'm confused because I don't know whether to create bound or unbound text
boxes. As well, what do I bound them to. Also, when I create the text
boxes, I can't enter data in them to do the search - why is that? Am I
missing something here?

Please spell out the steps to accomplish this task.
 
G

Guest

Create your textboxes in the form's Header section and leave them unbound. In
the query that the form is based on, your criteria for the date field will
point to the two textboxes. For example, you might put this in the date
field's criteria:

Between Forms!MyForm!txtFromDate And Forms!MyForm!txtToDate

After entering the date in the textboxes, you just need to requery the form.

Barry
 
G

Guest

This works until I put in the parameters in the query; the result is that the
form pulls in no data from the query at that point, even if I don't enter a
start and end date.

What do you mean requery the form?
 
G

Guest

If the form is bound to the query, when it opens, the two textboxes are
empty, meaning the query will not return any records. After you fill the
textboxes, you need to requery the form. This means that it re-runs the
underlying query.

Put a button in the header or footer. In the button's OnClick event, create
a new macro by clicking to elipsis to the right and selecting Macro Builder.
In the Action column, choose Requery. Save the macro (name it whatever you
want) and click close. The name of the macro should now appear in the OnClick
event. Clicking the button will requery the form.

Barry
 
G

Guest

Thanks Barry. Your directions for the macro were clear but I couldn't insert
it in the on click event. Instead I used Me.Requery and it worked
wonderfully - without the requery this is really bothersome.
 

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