Access report and VBA

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!
 
M

Matt Weyland

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
 
M

Marshall Barton

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.
 

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