Open desired report on condition

G

Gene R

I don't know VBA code, so I'm trying to get a Macro to open one of four
specific client reports depending on the billing code in an Invoices Table.
It is a temporary table witih only one record.

So I have four lines in the macro - one four each potential report. The
Conditions and Actions are as follows:

Condition: Action:
("[Billing Code]","Invoices Table")="404040" Open Report (404040 Invoice
Report)
("[Billing Code]","Invoices Table")="504030" Open Report (504030 Invoice
Report)
("[Billing Code]","Invoices Table")="605040" Open Report (605040 Invoice
Report)
("[Billing Code]","Invoices Table")="706050" Open Report (706050 Invoice
Report)

The problem is, although the table has only one record, all four reports run
using the same table. Why are all four running when the Billing Code only
matches one?!

Thank you!!
 
S

Steve Schapel

Gene,

("[Billing Code]","Invoices Table")="404040" doesn't mean anything in
Access, it is not standard syntax for anything at all. Even if it was,
Access wouldn't be able to "know" that you mean the first record (even
if there is only one record, there's no guarantee of that, you know?)

You could, hiowever, get the effect you are after by using a domain
function, for example:
DLookup("[Billing Code]","Invoices Table")="404040"
or
DFirst("[Billing Code]","Invoices Table")="404040"
 
G

Gene R

Thanks for the lesson, Steve! Worked perfectly, of course! Happy Holidays!!

GR

Steve Schapel said:
Gene,

("[Billing Code]","Invoices Table")="404040" doesn't mean anything in
Access, it is not standard syntax for anything at all. Even if it was,
Access wouldn't be able to "know" that you mean the first record (even
if there is only one record, there's no guarantee of that, you know?)

You could, hiowever, get the effect you are after by using a domain
function, for example:
DLookup("[Billing Code]","Invoices Table")="404040"
or
DFirst("[Billing Code]","Invoices Table")="404040"

--
Steve Schapel, Microsoft Access MVP

Gene said:
I don't know VBA code, so I'm trying to get a Macro to open one of four
specific client reports depending on the billing code in an Invoices Table.
It is a temporary table witih only one record.

So I have four lines in the macro - one four each potential report. The
Conditions and Actions are as follows:

Condition: Action:
("[Billing Code]","Invoices Table")="404040" Open Report (404040 Invoice
Report)
("[Billing Code]","Invoices Table")="504030" Open Report (504030 Invoice
Report)
("[Billing Code]","Invoices Table")="605040" Open Report (605040 Invoice
Report)
("[Billing Code]","Invoices Table")="706050" Open Report (706050 Invoice
Report)

The problem is, although the table has only one record, all four reports run
using the same table. Why are all four running when the Billing Code only
matches one?!

Thank you!!
 

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