Unbound input text boxes for multi-tab page form

P

Pendragon

Access03/WinXP

I have a form with several tab control pages. Each page refers to a
different module within the database (e.g., membership, events, product
orders, etc.). Rather than creating unbound text boxes on each tab control
page for a user to input a start and end date (which will filter the various
reports run by command buttons on the pages), I thought it more efficient to
have a single set of unbound text boxes to which all tab control pages (and
the reports/command buttons on them) could refer, namely txtStartDate and
txtEndDate.

For clarity, I placed these boxes in the form header as all of the tab
control pages are obviously in the detail section. To test the reference, I
ran one of the reports queries in Query Design mode with a specific reference
to the text fields:

SELECT CompanyID, CompanyName, RecordCreateDate, UserID FROM tblCompany
WHERE tblCompany.RecordCreateDate >= Forms!frmReports.txtStartDate and
tblCompany.RecordCreateDate <= Forms!frmReports.txtEndDate.

When I run the query, I get an error message noting that the db jet engine
does not recognize [Forms]![frmReports].[txtStartDate] as a valid field name
or expression.

Can you not place such unbound fields in a form header? Do these need to be
in the form detail section, but not on a specific tab control page?

Thanks for any education you can provide.
 
M

Mr B

Pendragon,

Give this revised version of your sql statement:

SELECT CompanyID, CompanyName, RecordCreateDate, UserID FROM tblCompany
WHERE tblCompany.RecordCreateDate >= #" & Forms!frmReports.txtStartDate & "
# and tblCompany.RecordCreateDate <= # " & Forms!frmReports.txtEndDate & "#

Watch for text wraping in this forum.

Basically what you need is to place: #" & in front of the reference to the
control on your form and & "# after the reference to the control.
 

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