Access report and VBA

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I am writing some simple code behind an Access report. I am a little new to
VBA but familiar with VB.

What I have: A report that references a single table. Each page of the
report is generated from only one record of the table, thus one page per
record in the table.

What I need: I am looking for a simple way to get the value of a field in
the "current" record of the table. The field is not going to be displayed on
the report, but I use its value in a conditional statement upon format of
each page. What is the code to reference a field in the current record?

Thanks in advance for any help!
 
Open your report in design mode
AltF-11

on your object pull down list find Report
on the event list find OnCurrent

add your conditional formatting for the defined field.

Hope this helps.

if you have any questions let me know.

mweyland at mnqio dot sdps dot ort
 
Eric said:
I am writing some simple code behind an Access report. I am a little new to
VBA but familiar with VB.

What I have: A report that references a single table. Each page of the
report is generated from only one record of the table, thus one page per
record in the table.

What I need: I am looking for a simple way to get the value of a field in
the "current" record of the table. The field is not going to be displayed on
the report, but I use its value in a conditional statement upon format of
each page. What is the code to reference a field in the current record?

For speed optimazation reasons, reports do not load data
fields that are not bound to a control in the report.

Just add an invisible text box bound to the field you want
to reference in code.
 
Back
Top