PC Review


Reply
Thread Tools Rate Thread

Calculated Form Fields do not fill data into related table fields

 
 
=?Utf-8?B?cmljaDE4Mzg=?=
Guest
Posts: n/a
 
      12th Feb 2005
I am creating a db for a retail business. I have multiple vendors from which
I buy the same product for resale. These vendors issue pricing either based
on net or varied discoumts from their list price. I created a table for the
products, a sub table for the vendors, and another sub table to caculate
pricing based on list / net costs. On the form, I'll take the vendors price
and use a Yes/No field to determine a calculation for my price, eg. Iif
([List /Net], [Vendor Price], [Vendor Price] - ([Vendor Price] * [Vendor
Discount])) . The calculations in the form field [My Price] work, however
this calculated number does not show up in the table field [My Price], nor
can I link this calculated number into other fields on other forms (PO's). I
have checked the one-to-many relationships and referential integrity /
cascade up and delete and nothing?
 
Reply With Quote
 
 
 
 
Rob Parker
Guest
Posts: n/a
 
      12th Feb 2005
First, it's generally bad practice to store calculated values in tables; you
should do the calculation when the value is required for display on a form,
or printing in a report. The exception to this rule is if the calculated
value should not change when the underlying data is changed, eg. invoice
data should not change with subsequent price changes; it should reflect the
value obtained from the price at the time it was issued. It seems that in
your current situation you should not be storing the calculated [My Price]
(although you might want/need to store data generated from this in your PO
forms).

Next, you can't use a control to calculate a value (in this case, it will
contain your iif(...) formula, and also bind it to a field in a table or
query. You will need code to insert or edit the table data when the value
is calculated; this will normally be placed in the AfterUpdate event of your
control, or in a form's Current event - it's up to you to decide where the
most appropriate place is.

Last, there may be several reasons why you can't use the calculated value in
another form. The form containing the calculated value must be open; and
the control containing the value must be referred to correctly. This second
point is a likely source of error if you are using wizard-generated forms,
since the control will have the same name as the field to which it is
bound - or not, in your case ;-) If your control containing the calculated
value is named [My Price], the other form(s) may be trying to get the value
from the [My Price] field in the table - and this doen't contain the value,
as discussed above. It's good practice to rename wizard-generated controls,
following a standard naming convention. It's also good practice not to
include spaces in names of anything in your database (objects, fields,
controls, ...). Your calculated value control should have a name such as
tboxMyPrice, and you can use its value on another form (if its form is open)
by referring to it as Forms("frmMyFormName").tboxMyPrice. [Note: this
syntax will not work if your control is on a subform, since subforms are not
members of the Forms collection.]

Hope this helps - and I also hope this doesn't appear twice - my system
crashed after I wrote this and (I think) before it was sent.

Rob

"rich1838" <(E-Mail Removed)> wrote in message
news:1C32BF04-17E0-44E2-B120-(E-Mail Removed)...
> I am creating a db for a retail business. I have multiple vendors from

which
> I buy the same product for resale. These vendors issue pricing either

based
> on net or varied discoumts from their list price. I created a table for

the
> products, a sub table for the vendors, and another sub table to caculate
> pricing based on list / net costs. On the form, I'll take the vendors

price
> and use a Yes/No field to determine a calculation for my price, eg. Iif
> ([List /Net], [Vendor Price], [Vendor Price] - ([Vendor Price] * [Vendor
> Discount])) . The calculations in the form field [My Price] work, however
> this calculated number does not show up in the table field [My Price], nor
> can I link this calculated number into other fields on other forms (PO's).

I
> have checked the one-to-many relationships and referential integrity /
> cascade up and delete and nothing?



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy form fields to related table RcCypher Microsoft Access Macros 1 19th Mar 2010 10:23 PM
Auto fill of related fields in a form =?Utf-8?B?U3Rhbl9C?= Microsoft Access Forms 6 11th Oct 2007 05:17 PM
Data from calculated fields in form not getting into table.. =?Utf-8?B?U2VhbiBEdVBvbnQ=?= Microsoft Access Getting Started 16 4th Nov 2006 10:39 PM
storing calculated form fields to a table =?Utf-8?B?RG93bmluZ0RldmVsb3BtZW50cw==?= Microsoft Access Forms 4 8th Mar 2005 02:33 PM
Populate Form and Table with Related Fields Kevin Sullivan Microsoft Access Forms 0 25th May 2004 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.