Help with New Field on Report

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

Guest

Hi there. Just when I think I know what I'm doing in Access, it kicks my butt
on the simplest of issues!
I have a form that allows users to select criteria for printing a report. It
generates an Sql to get the appropriate record from the file called "Glass"
(select * from Glass where [etc.])
The code runs the DoCmd.Open Report using the criteria.
I added a new field to the file, and am trying to access it within the
report.
but when I use the field (PackagingID) it says Variable not found.
I will need this field to get the packaging description from the Package
File. (A new file I created as well). Can anyone point me in the right
direction? Thanks a bunch.
 
This should be progress but...
I clicked on the reports properties and saw that the Record Souce of the
report is a query. So I added the field to the query. When I run the query, I
see the field in there. But when I try to access it within the report code, I
still get variable not defined. Within the query, I linked the "Glass" file
to the "Packaging" file by the PackagingID. But I only included the
PackagingDesc field in the query. Dunno, feeling pretty beat up!
 
Does your generated Sql actually contain "select *..." or does it only
contain the where clause?

How are you using the variable in the report? Is it just a bound field as
the Control Source of a text box or are you using code in the report?
 
Yes, it does containt the "Select *". It appears in the report as an unbound
text box, and I was going to load it via the code. Only the PackagingID
appears in the file, so I have to get the actual description from the
Packaging file itself.

Duane Hookom said:
Does your generated Sql actually contain "select *..." or does it only
contain the where clause?

How are you using the variable in the report? Is it just a bound field as
the Control Source of a text box or are you using code in the report?

--
Duane Hookom
MS Access MVP


Abbey Normal said:
Hi there. Just when I think I know what I'm doing in Access, it kicks my
butt
on the simplest of issues!
I have a form that allows users to select criteria for printing a report.
It
generates an Sql to get the appropriate record from the file called
"Glass"
(select * from Glass where [etc.])
The code runs the DoCmd.Open Report using the criteria.
I added a new field to the file, and am trying to access it within the
report.
but when I use the field (PackagingID) it says Variable not found.
I will need this field to get the packaging description from the Package
File. (A new file I created as well). Can anyone point me in the right
direction? Thanks a bunch.
 
How are you using the Select statement? Do you have code that assigns this
string to the Record Source of your report?

Try to use "table" or "query" rather than "file".

--
Duane Hookom
MS Access MVP


Abbey Normal said:
Yes, it does containt the "Select *". It appears in the report as an
unbound
text box, and I was going to load it via the code. Only the PackagingID
appears in the file, so I have to get the actual description from the
Packaging file itself.

Duane Hookom said:
Does your generated Sql actually contain "select *..." or does it only
contain the where clause?

How are you using the variable in the report? Is it just a bound field as
the Control Source of a text box or are you using code in the report?

--
Duane Hookom
MS Access MVP


Abbey Normal said:
Hi there. Just when I think I know what I'm doing in Access, it kicks
my
butt
on the simplest of issues!
I have a form that allows users to select criteria for printing a
report.
It
generates an Sql to get the appropriate record from the file called
"Glass"
(select * from Glass where [etc.])
The code runs the DoCmd.Open Report using the criteria.
I added a new field to the file, and am trying to access it within the
report.
but when I use the field (PackagingID) it says Variable not found.
I will need this field to get the packaging description from the
Package
File. (A new file I created as well). Can anyone point me in the right
direction? Thanks a bunch.
 
The SQL appears to be fine - I get the correct record and the rest of the
info appears on the report - the only thing is if I try to reference that new
field I added to the table it says variable not defined.
The report itself uses a query as a record source - I added the new field to
this and it runs fine. but same problem Variable not defined.
 
Nevermind! I quit trying to use the field in the code, just referenced it
directly in a text box, it works perfectly. The only fix I made was to the
relationships in the table, so maybe that was the problem all along. Thanks
for the help!

Abbey Normal said:
The SQL appears to be fine - I get the correct record and the rest of the
info appears on the report - the only thing is if I try to reference that new
field I added to the table it says variable not defined.
The report itself uses a query as a record source - I added the new field to
this and it runs fine. but same problem Variable not defined.

Abbey Normal said:
Hi there. Just when I think I know what I'm doing in Access, it kicks my butt
on the simplest of issues!
I have a form that allows users to select criteria for printing a report. It
generates an Sql to get the appropriate record from the file called "Glass"
(select * from Glass where [etc.])
The code runs the DoCmd.Open Report using the criteria.
I added a new field to the file, and am trying to access it within the
report.
but when I use the field (PackagingID) it says Variable not found.
I will need this field to get the packaging description from the Package
File. (A new file I created as well). Can anyone point me in the right
direction? Thanks a bunch.
 
Back
Top