Reference extracted text for field selections

D

Dave Schoenbrun

We have an ErrorLog table that logs calculation errors on account invoicing.
Every account belongs to an Invoice Group, but has a unique Account Number.
The "master account" for the Invoice Group has the matching Account Number.

Because most errors pertain to the Invoice as a whole (including all
accounts in the invoice group) my ErrorLog query displays fields for:

From ErrorLog: error info, SubRequestID as Account Number (linked to
WACCT.ACCT#)
From WACCT: Invoice Group.

There is one error (BILLCALC_INVOICE_GAP) that in its description will
indicate which specific account tripped the error, but the SubRequestID that
shows in the ErrorLog Table displays a catchall account number that isn't
useful. We're able to extract the actual affected account number using the
following SELECT statement from the MessageCode and use it for the Account
Number Field:

IIf([dbo_ERRORLOGFILE]![messagecode]="BILLCALC_INVOICE_GAP",Mid([dbo_ERRORLOGFILE]![description],115,141),[dbo_WACCT]![AccountNumber]) AS [AccountNumber],

I need to know how to somehow reference/capture this Account Number so I can
find the appropriate Invoice Group attached to that Account in the WACCT
table. It seems as if I need to set a subquery selecting the Invoice Group
where AccountNumber = the above statement

I've tried creating a query paramater, but I haven't figured out how to
assign a non-prompted value in the SQL code. I've tried creating an alias
for the AccountNumber field and referencing it, but again, I get a paramater
prompt. Any Ideas?
 

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