Filling a Text Box on a Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box on a report that I have to fill with a specific row in a
table.

I tried making this control source statement:
= [TempAverage]![Average] where [TempAverage]![Month] = 10 And
[TempAverage]![Year] = 2004

I also tried making a VB statement in the background of the Report:
strsql = "Select * from TempAverage where Month = 10 and Year = 2004"
Set Oct2004 = CurrentDb.OpenRecordset(strsql)
Text582.Text = Oct2004!Average

Is there a simpler way of doing it without writing a query for each text
box? There are 288 text boxes. I don't really want to make 288 queries.

Thanks in Advance,
Elena
 
You need to create a query based on your TempAverage table and set the
criteria for Month to 10 and criteria for Year to 2004. Then you base your
report on this query. Use the report wizard to create your report.

BTW, Month and Year are reserved words; you should not use them for field
names. Sooner or later you are going to have problems with your database
because of this; you need to change the field names.
 
I was trying to avoide doing that. If i set up a query to do that for each
criteria, i would have to make 288 queries. I was wondering if there was
another method. Is there no other method?

Thanks for the reserved words tip, I will change them in my database.

~Elena

PC Datasheet said:
You need to create a query based on your TempAverage table and set the
criteria for Month to 10 and criteria for Year to 2004. Then you base your
report on this query. Use the report wizard to create your report.

BTW, Month and Year are reserved words; you should not use them for field
names. Sooner or later you are going to have problems with your database
because of this; you need to change the field names.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Elena said:
I have a text box on a report that I have to fill with a specific row in a
table.

I tried making this control source statement:
= [TempAverage]![Average] where [TempAverage]![Month] = 10 And
[TempAverage]![Year] = 2004

I also tried making a VB statement in the background of the Report:
strsql = "Select * from TempAverage where Month = 10 and Year = 2004"
Set Oct2004 = CurrentDb.OpenRecordset(strsql)
Text582.Text = Oct2004!Average

Is there a simpler way of doing it without writing a query for each text
box? There are 288 text boxes. I don't really want to make 288 queries.

Thanks in Advance,
Elena
 
Need more information!

1. Tell us about the data in your table with some sample data.

2. What data do you want to report in the report?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Elena said:
I was trying to avoide doing that. If i set up a query to do that for each
criteria, i would have to make 288 queries. I was wondering if there was
another method. Is there no other method?

Thanks for the reserved words tip, I will change them in my database.

~Elena

PC Datasheet said:
You need to create a query based on your TempAverage table and set the
criteria for Month to 10 and criteria for Year to 2004. Then you base your
report on this query. Use the report wizard to create your report.

BTW, Month and Year are reserved words; you should not use them for field
names. Sooner or later you are going to have problems with your database
because of this; you need to change the field names.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Elena said:
I have a text box on a report that I have to fill with a specific row in a
table.

I tried making this control source statement:
= [TempAverage]![Average] where [TempAverage]![Month] = 10 And
[TempAverage]![Year] = 2004

I also tried making a VB statement in the background of the Report:
strsql = "Select * from TempAverage where Month = 10 and Year = 2004"
Set Oct2004 = CurrentDb.OpenRecordset(strsql)
Text582.Text = Oct2004!Average

Is there a simpler way of doing it without writing a query for each text
box? There are 288 text boxes. I don't really want to make 288 queries.

Thanks in Advance,
Elena
 
Back
Top