How to "POST" accounting data into underlying tables

G

Guest

Steve,

The following is a query which generates the expression value for NetRebate
which is in my subform. It appears the subform perfectly. However, when I
try to use the Set Value macro to copy the NetRebate amount into the main
form I get the error message. Incidentally, the formatting I was talking
about was Format(xxxx,"Currency"). However, that was not the problem. The
error message persists even when that formattting is removed.

SELECT Invoices.RebatePaidApplied, Invoices.Closed, Invoices.INVOICEID,
IIf(Invoices!ClosedHow<3,[Invoices Payments Received To Date]![SumOfAmount
Paid]-(Invoices!AdvanceAmount+[Disc Fee on Payment
Received]!DiscFee),Nz([Invoices Payments Received To Date]![SumOfAmount
Paid],0)-(Invoices!AdvanceAmount+[Disc Fee on Recourse or
Chargeback]!DiscFee)) AS NetRebate
FROM ((Invoices LEFT JOIN [Invoices Payments Received To Date] ON
Invoices.INVOICEID = [Invoices Payments Received To Date].INVOICEID) LEFT
JOIN [Disc Fee on Payment Received] ON Invoices.INVOICEID = [Disc Fee on
Payment Received].INVOICEID) LEFT JOIN [Disc Fee on Recourse or Chargeback]
ON Invoices.INVOICEID = [Disc Fee on Recourse or Chargeback].INVOICEID
WHERE (((Invoices.RebatePaidApplied)=No) AND ((Invoices.Closed)=Yes));


Does this shed any light??
 
G

Guest

Joseph,

The following is a query which generates the expression value for NetRebate
which is in my subform. It appears the subform perfectly. However, when I
try to use the Set Value macro to copy the NetRebate amount into the main
form I get the error message. Incidentally, the formatting I was talking
about was Format(xxxx,"Currency"). However, that was not the problem. The
error message persists even when that formattting is removed.

SELECT Invoices.RebatePaidApplied, Invoices.Closed, Invoices.INVOICEID,
IIf(Invoices!ClosedHow<3,[Invoices Payments Received To Date]![SumOfAmount
Paid]-(Invoices!AdvanceAmount+[Disc Fee on Payment
Received]!DiscFee),Nz([Invoices Payments Received To Date]![SumOfAmount
Paid],0)-(Invoices!AdvanceAmount+[Disc Fee on Recourse or
Chargeback]!DiscFee)) AS NetRebate
FROM ((Invoices LEFT JOIN [Invoices Payments Received To Date] ON
Invoices.INVOICEID = [Invoices Payments Received To Date].INVOICEID) LEFT
JOIN [Disc Fee on Payment Received] ON Invoices.INVOICEID = [Disc Fee on
Payment Received].INVOICEID) LEFT JOIN [Disc Fee on Recourse or Chargeback]
ON Invoices.INVOICEID = [Disc Fee on Recourse or Chargeback].INVOICEID
WHERE (((Invoices.RebatePaidApplied)=No) AND ((Invoices.Closed)=Yes));

The Set Value macro I'm using is:

Item: [Net Rebate]

Expression: IIf([Rebated]=-1,[Forms]![Rebates Payable and Discount
Fees]![Rebates Payable Subform Invoices Closed 1 or 2 but not
Rebated].[Form]![Rebate and Fees upon Payment].[Form]![NetRebate],Null)

After this I run the Refresh Command.

Does this shed any light?? Thanks for your help.



Joseph R. Pottschmidt said:
Dear FJquestioner:

If you can post your macro on this forum, I would be able to
troubleshoot what the problem is. Without coding examples of what you've
written, I wouldn't be able to guess what it might be.

Joe P.

-----Original Message-----
From: FJquestioner [mailto:[email protected]]
Posted At: Tuesday, June 06, 2006 2:38 PM
Posted To: microsoft.public.access.macros
Conversation: How to "POST" accounting data into underlying tables
Subject: Re: How to "POST" accounting data into underlying tables

Steve,

I've got a form with a few "Null" fields and a checkbox.

Within that form is an invisible subform containing the results of a
query.
Each result is formatted as "Currency" both within the query formulas
and on
the form itself.

The Null fields in the master form are also formated as Currency both
within
the form and in the underlying table (both Data Type and Format).

I've got a macro which is supposed to copy the data in the subform into
the
appropriate fields in the master form if the checkbox is clicked.

However, when the macro runs I keep getting the error message:

THE VALUE YOU ENTERED ISN'T VALID FOR THIS FIELD.
For example, you may have entered text in a numeric field or a number
that
is larger than the FieldSize setting permits.

I can't figure out what is causing this. Do you by chance have any
suggestions as to possible problems?

Thanks again.




Steve Schapel said:
FJ,

I have replied in the .queries newsgroup.
 
S

Steve Schapel

FJ,

Ok, so am I right in my understanding that this query is the Record
Source of the [Rebate and Fees upon Payment] subform, which is a subform
on the [Rebates Payable Subform Invoices Closed 1 or 2 but not Rebated]
subform, which is a subform on the [Rebates Payable and Discount Fees]
form? And the macro runs on an event on the [Rebates Payable and
Discount Fees] form? And on the [Rebates Payable and Discount Fees]
form, there is a control named NetRebate. Ok, can you also let us know
what is the Record Source of the [Rebates Payable and Discount Fees]
form? If a table, is NetRebate a field in this table? If a query, what
is the SQL of the query?

Clarification of the above may help. However, you are also referring to
the current record on the [Rebate and Fees upon Payment] subform, and
then I think you said this subform was hidden? So it can't have a
current record? So it can't work? ... Just surmising here.

And beside all this, well, to be honest, if you end up wanting to set
the value of one control to the value of another control, it is almost
always an indication of a database design problem. But that's starting
to get complicated. The good news is that when you finally get through
problems like this, you find out that there is a very easy way to do
what you originally thought was difficult.

--
Steve Schapel, Microsoft Access MVP
Steve,

The following is a query which generates the expression value for NetRebate
which is in my subform. It appears the subform perfectly. However, when I
try to use the Set Value macro to copy the NetRebate amount into the main
form I get the error message. Incidentally, the formatting I was talking
about was Format(xxxx,"Currency"). However, that was not the problem. The
error message persists even when that formattting is removed.

SELECT Invoices.RebatePaidApplied, Invoices.Closed, Invoices.INVOICEID,
IIf(Invoices!ClosedHow<3,[Invoices Payments Received To Date]![SumOfAmount
Paid]-(Invoices!AdvanceAmount+[Disc Fee on Payment
Received]!DiscFee),Nz([Invoices Payments Received To Date]![SumOfAmount
Paid],0)-(Invoices!AdvanceAmount+[Disc Fee on Recourse or
Chargeback]!DiscFee)) AS NetRebate
FROM ((Invoices LEFT JOIN [Invoices Payments Received To Date] ON
Invoices.INVOICEID = [Invoices Payments Received To Date].INVOICEID) LEFT
JOIN [Disc Fee on Payment Received] ON Invoices.INVOICEID = [Disc Fee on
Payment Received].INVOICEID) LEFT JOIN [Disc Fee on Recourse or Chargeback]
ON Invoices.INVOICEID = [Disc Fee on Recourse or Chargeback].INVOICEID
WHERE (((Invoices.RebatePaidApplied)=No) AND ((Invoices.Closed)=Yes));


Does this shed any light??

Steve Schapel said:
FJ,

The bit that makes me the most suspicious is "formatted as 'Currency'
within the query formulas". What do you mean by this?
 
G

Guest

Steve,
I understand your comment on the design issue. I am in the factoring
business which means I purchase the accounts receivable of other companies at
a discount from face value and the debtor pays me down the road (hopefully!).
If I am buying a receivable of say $100, I'll pay $85 as an up front
advance. Then later when I receive the $100 from the debtor I will rebate the
company I bought the invoice from, the remaining $15, less a discount fee
(which works like an interest rate). So this database is to keep track of
all the invoices purchased as well as the advances made and the rebates owed
and the discount fees I've earned.

In the section I'm working on now, I have queries which calculate the rebate
owed and the discount fee earned for each invoice. I have a form [Rebates
Payable and Discount Fees] in which I select a client and a currency. Then
the subform [Rebates Payable Subform Invoices Closed 1 or 2 but not Rebated]
displays all closed (ie paid) invoices (from the Invoices table) which match
the client and currency criteria.

My objective is to select from this list, those invoices on which I
currently want to book a rebate payable and book my discount fee. I indicate
this by clicking a checkbox within that Subform (which is the
"FeeAndRebateAdded" field in the underlying Invoices table).

Clicking this checkbox triggers the macro which then takes the rebate and
discount fee calculations from the queries and places them into the
[RebatePayale] and [DiscFee] fields of the subform and hence into the
underlying Invoices table. The reason I do this (and please correct me if
I'm wrong) is that this data (rebtes, discount fees and other data) is going
to be exported into the QuickBooks accounting program and needs to remain
static. In other words the rebate and discount fee calculations, once made
must remain the same even if I later change the advance rate of interest
charges for a given client (which would alter the results of the query).

The only resaon I have an invisible subform [Rebate and Fees upon Payment]
within the subform [Rebates Payable Subform Invoices Closed 1 or 2 but not
Rebated] is that it contains the rebate and discount fee query calculations
and I don't know how to get a marco to run on an object that isn't part of
the currently open form. (Of course I could get the macro to Open the Query
independently but I don't know how to do this without the query physically
showing up on the screen).

I have other forms and queries in the program that do similar functions and
I've never had a problem with the macro. This error message about an invalid
field value has me stumped.

Thanks.




Steve Schapel said:
FJ,

Ok, so am I right in my understanding that this query is the Record
Source of the [Rebate and Fees upon Payment] subform, which is a subform
on the [Rebates Payable Subform Invoices Closed 1 or 2 but not Rebated]
subform, which is a subform on the [Rebates Payable and Discount Fees]
form? And the macro runs on an event on the [Rebates Payable and
Discount Fees] form? And on the [Rebates Payable and Discount Fees]
form, there is a control named NetRebate. Ok, can you also let us know
what is the Record Source of the [Rebates Payable and Discount Fees]
form? If a table, is NetRebate a field in this table? If a query, what
is the SQL of the query?

Clarification of the above may help. However, you are also referring to
the current record on the [Rebate and Fees upon Payment] subform, and
then I think you said this subform was hidden? So it can't have a
current record? So it can't work? ... Just surmising here.

And beside all this, well, to be honest, if you end up wanting to set
the value of one control to the value of another control, it is almost
always an indication of a database design problem. But that's starting
to get complicated. The good news is that when you finally get through
problems like this, you find out that there is a very easy way to do
what you originally thought was difficult.

--
Steve Schapel, Microsoft Access MVP
Steve,

The following is a query which generates the expression value for NetRebate
which is in my subform. It appears the subform perfectly. However, when I
try to use the Set Value macro to copy the NetRebate amount into the main
form I get the error message. Incidentally, the formatting I was talking
about was Format(xxxx,"Currency"). However, that was not the problem. The
error message persists even when that formattting is removed.

SELECT Invoices.RebatePaidApplied, Invoices.Closed, Invoices.INVOICEID,
IIf(Invoices!ClosedHow<3,[Invoices Payments Received To Date]![SumOfAmount
Paid]-(Invoices!AdvanceAmount+[Disc Fee on Payment
Received]!DiscFee),Nz([Invoices Payments Received To Date]![SumOfAmount
Paid],0)-(Invoices!AdvanceAmount+[Disc Fee on Recourse or
Chargeback]!DiscFee)) AS NetRebate
FROM ((Invoices LEFT JOIN [Invoices Payments Received To Date] ON
Invoices.INVOICEID = [Invoices Payments Received To Date].INVOICEID) LEFT
JOIN [Disc Fee on Payment Received] ON Invoices.INVOICEID = [Disc Fee on
Payment Received].INVOICEID) LEFT JOIN [Disc Fee on Recourse or Chargeback]
ON Invoices.INVOICEID = [Disc Fee on Recourse or Chargeback].INVOICEID
WHERE (((Invoices.RebatePaidApplied)=No) AND ((Invoices.Closed)=Yes));


Does this shed any light??

Steve Schapel said:
FJ,

The bit that makes me the most suspicious is "formatted as 'Currency'
within the query formulas". What do you mean by this?

--
Steve Schapel, Microsoft Access MVP

FJquestioner wrote:
Steve,

I've got a form with a few "Null" fields and a checkbox.

Within that form is an invisible subform containing the results of a query.
Each result is formatted as "Currency" both within the query formulas and on
the form itself.

The Null fields in the master form are also formated as Currency both within
the form and in the underlying table (both Data Type and Format).

I've got a macro which is supposed to copy the data in the subform into the
appropriate fields in the master form if the checkbox is clicked.

However, when the macro runs I keep getting the error message:

THE VALUE YOU ENTERED ISN'T VALID FOR THIS FIELD.
For example, you may have entered text in a numeric field or a number that
is larger than the FieldSize setting permits.

I can't figure out what is causing this. Do you by chance have any
suggestions as to possible problems?
 
S

Steve Schapel

FJ,
...
... I don't know how to get a marco to run on an object that isn't part of
the currently open form. (Of course I could get the macro to Open the Query
independently but I don't know how to do this without the query physically
showing up on the screen).

This is really a job for an Update Query. An Update Query is an "action
query" (as against a query that returns a data set), and as such nothing
will physically show on the screen. The Update Query would be based on
the same sort of data as the query that you have your subform based on.
You can use an OpenQuery action in your macro to run the update.
... This error message about an invalid
field value has me stumped.

I have never tried to run a SetValue macro with an IIf() function in the
Expression argument, so I'm not 100% sure it's possible. However, I
think you would need a = in the front of the Expression argument in the
SetValue macro.
 
J

Joseph R. Pottschmidt

The other thing that SQL Statements don't support is IIF that is not
part of the available KEYWORD language set, this is an exclusive MS
Access Input condition that is used in VBA or VB for Conditional Input,
as far as I know, it is not usable in an SQL Statement and in turn will
not process anything in that statement. If there are Queries, and you
have these statements in them, then I would suggest what STEVE is saying
and use an Update Query, this way and you keep creating entries of items
and you work out there Charges and refunds, those can be kept in various
tables that when SUM'ed at the time that you need to cut a check for
that particular company, you have that current charges and interest
payments based on how long it took to get the money back and how long
the float was.

It just sounds like you're trying to manipulate data at the table level
with a form, and unless you are going to code that whole process line by
line, it would be a great deal faster is you use an update query(s).



-----Original Message-----
From: Steve Schapel [mailto:[email protected]]
Posted At: Thursday, June 08, 2006 12:41 PM
Posted To: microsoft.public.access.macros
Conversation: How to "POST" accounting data into underlying tables
Subject: Re: How to "POST" accounting data into underlying tables

FJ,
...
... I don't know how to get a marco to run on an object that isn't part of
the currently open form. (Of course I could get the macro to Open the Query
independently but I don't know how to do this without the query physically
showing up on the screen).

This is really a job for an Update Query. An Update Query is an "action

query" (as against a query that returns a data set), and as such nothing

will physically show on the screen. The Update Query would be based on
the same sort of data as the query that you have your subform based on.
You can use an OpenQuery action in your macro to run the update.
... This error message about an invalid
field value has me stumped.

I have never tried to run a SetValue macro with an IIf() function in the

Expression argument, so I'm not 100% sure it's possible. However, I
think you would need a = in the front of the Expression argument in the
SetValue macro.
 

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