Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A problem Getting A Report To Work Within Access 97

Status
Not open for further replies.

AD1

Technical User
May 21, 2002
3
GB
TECHNICAL INFORMATION:

I have created a Report within Access 97.

Tables: 3 tables used via ODBC.

Query: 2 Queries are used, the second one being a query of the first. The Second query is linked to the Record Source of the Form (in Design View).

Form: The Form is opened via a command button on the Main switchboard form. It comprises one Combo box, listing a set of values that the user can select from and 2 unbound text boxes in which the user inputs 2 dates, (ie a date range). A command button on the form then generates the report.

Report: The Record Source property of the Report is linked to the second query.

The Report Header section comprises 3 labels and text boxes used to display the value selected and data input by the user on the form. (This is a requirement of the report).
All 3 have been linked to the form using Expression Builder within their respective Control Source Properties.

The Detail section's text boxes have all been selected from the Field List.

THE PROBLEM

When I input the first date and second date of the range into the text boxes on the form and then generate the Report via the command button, though the date range is displayed on the Report, the detail section shows dates that are outside of the range.

This is obviously because the Detail section is not linked to the query. I therefore reopened the second query in Design View, and in the Criteria row of the Date field, built the following, using Expression Builder:

Between [Forms]![frmOrdersAuth]![txtEnterFirstPODate] And [Forms]![frmOrdersAuth]![txtEnterLastPODate]

After saving the query and closing it. I then went to open the Form to select and input data. However, to my astonishment the form was completely blank, though in Design View, everything is displayed as it should be.

CONCLUSION:

On removal of the above Expression, the Form works fine again, but obviously the Detail section of the Report does
not display the corect date range. So I'm really none the wiser.

If I enter the above expression in the Parameters box and select the Date/Time as the Data Type - I just get an "Invalid Bracketing" Error Message, though after rechecking the expression entered within it, I can see nothing wrong with it.

I am currently going round in circles trying to get this to work, so if anyone out there can tell me where I'm going wrong and what I need to do to get it to work, it would be
very much appreciated.

Many Thanks

Antony











 
Hi,

Can I ask why your form is linked to the Query 2 ?

What I suggest is that you leave your form RECORD SOURCE blank and that you use your second alternative. Of what I understand it should fix your problem.

Hope it's of any help
Salvatore Grassagliata
 
Salvatore,

Many thanks for your reply.

Not being an expert and just trying to find my way, I'd assumed that the Form needed to have its Record Source Property linked to the query. Now I realise that this is not the case, I have indeed left the property blank and instead, added the following Expression to fields in the Second Query in the Criteria rows:

1st Field:

Like [Forms]![frmOrdersAuth]![Combo6]

2nd Field:

Between [Forms]![frmOrdersAuth]![Text2] And [Forms]![frmOrdersAuth]![Text4]


The report as a result now works perfectly displaying only the records within the specified range.

Thanks again for your advice

Regards

Antony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top