473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Linking Data in a Table to Autopopulated Data in a Form

I apologize if I'm not asking the question correctly.

I am working with a db that stores records of people who are attending summer camp. The cost is connected to several factors: 1. The persons age

(field) Camp Fee

=IIf([Camp Attending]="Senior","$180.00",IIf([Camp Attending]="Junior","$170.00",IIf([Camp Attending]="Intermediate","$170.00")))

2. The date the app is received

(field) Pre-Pay Discount

=IIf([Postmarked Date]<="5/3/2010","$40.00")

and 3. Special discounts.

I have been able to auto-populate certain "cost" fields based on answers to the above questions. However, the amounts which are automatically entered in the fields from the data entry form do not show up in the corresponding table. Also, when tabulating the "balance due", after pre-pay discounts and various other discounts are taken, the calculation doesn't seem to work with the auto populated fields and doesn't post to the corresponding table.

(field) Balance Due
=([campfee]-[Pre Pay Credit]+[tshirt]-[siblingdiscount]-[amtenclosed]-[Add'l Payment])

This seems simple but not sure what I'm doing wrong. New at this, so please bear with me,
May 14 '10 #1

✓ answered by Jim Doherty

@PastorD
Welcome to bytes PastorD:

What you are doing there is creating calculations in controls. Calculations like this are worked out on the fly and are not bound to any field in your table neither should they be. You are new to Access so will not yet know how things work generally but a few pointers:-

1) Your tables stored the data
2) Your queries query the tables
3) Base your forms on queries not the tables themselves

4) You will appreciate when you learn more that you can in actual fact create those calculations as virtual columns in a query. The effect being that the calculation appears as a column of useable data

3 1616
Jim Doherty
897 Expert 512MB
@PastorD
Welcome to bytes PastorD:

What you are doing there is creating calculations in controls. Calculations like this are worked out on the fly and are not bound to any field in your table neither should they be. You are new to Access so will not yet know how things work generally but a few pointers:-

1) Your tables stored the data
2) Your queries query the tables
3) Base your forms on queries not the tables themselves

4) You will appreciate when you learn more that you can in actual fact create those calculations as virtual columns in a query. The effect being that the calculation appears as a column of useable data
May 14 '10 #2
Thanks Jim!

I have a solid understanding of spreadsheets. I guess I'm trying to apply the same knowledge to db expecting it to work the same way.

So, if I understand correctly, I should only use calculations in the form so I can protect the integrity of the data in the table. Better to use queries and reports to make those final calculations based on good data from the table. It's hard to not want what I see in the form go directly into the table when I feel good about the accuracy of the data.

I need "balance due" calculations for reports. Still working on figuring out the best way to get that info.
May 14 '10 #3
Jim Doherty
897 Expert 512MB
@PastorD
For the most part you should not need to store calculated data. on the basis that if the underlying stored data on which the calculation is based were to change for some reason (maybe an 'update' later on or something like that) then you would also have to consider the stored static calculation as well.

It is of course lovely to see absolutely everything in your table but actually, you should have little need to look at your table in principle, because your table is really only a data storage bucket having a data indexing capability to facilitate speedier searching on appropriate columns.

The majority of your work should be via queries....or as you will learn, as time goes by these in conjunction with inbuilt functions and bespoke functions that you might make yourself using VBA language in modules.

There are certain caveats I consider personally to storing data that can be 'calculated' is a matter for you to decide ultimately.

One such example caveat I believe for storing calculated data when dealing with people records and that is the AGE of a person if the sole purpose of storing it is essentially to compare against another datetime item of data in the same row.

We know that a persons age can be calculated from a date of birth but the reality is that at any given time in history a persons age is 'fixed' it only increases in numeric value as future time goes by 'Age' therefore can be comfortably stored as static in my view. This is by no means the only example

The advantages of static storage of calculated data of course are evident imagine querying 100,000 records for those records grouped by Age of the person. You can immediately query a fixed value without having to work out the persons age for each row, which would be the case were the value calculated for each row everytime. If this field is also indexed then it will also be substantially quicker to return any resultset of data. In short, the computer has less processing to do per row.

There are inevitably UP sides and DOWN sides arguments as to the data storage principles, The end decision however is yours and is a matter of your design

Regards
May 14 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Derek Davlut | last post by:
I have a Table that contains data that I use in a query to manipulte the data through expressions. I have a form that uses the query for manipulating the data. How do I write the changed values...
1
by: QT | last post by:
Dear Sirs, I am using following codes to have a list box in form. When I run that form as a start up object, I have no problem. I have a MDI parent form which has user login feature. To...
2
by: Brian Mitchell | last post by:
Ok, I know this is an elementary question but I have a data grid that is bound to a data table and I can't seem to find a way to match the selected row in the grid with it's respective row in the...
11
by: Ron L | last post by:
I have a data table that lists a series of items in my database. In my user form, I want the user to be able to filter by a number of criteria (e.g. location, contract, date modified, etc). Other...
1
by: John | last post by:
Hi When using Table Adapter Configuration Wizard if 'Use SQL Statements' is selected as Command Type, the data table's name in dataset is retained and only its data adapter's select statements...
4
by: mousi | last post by:
Hello, I use Visual Basic 6 to get some data from an Access database... What I want to do, is create a table in my form to put that data inside. But I want to be able to access the table's cells...
6
by: subhashkumar | last post by:
Running data Append to a table Dear All, I need a help from this forum, I was developing a small tools for stock market. I get stuck when trying to save the running changes in a data field...
1
by: vaiism | last post by:
I have attempted using both Updata and Append Queries to solve this problem, and I can't seem to get it to work. I have three forms that each have an ID#, and a subform with related scores to...
5
by: joshapalooza | last post by:
I am new to scripting (and to Access), so don't be bashful if you feel you have to explain things to me on an elementary level. I have managed to create a table and its subsequent form title...
1
by: drwigginton | last post by:
I have created several bar charts in MS Access using query results to provide the data for the chart. I added data tables to the charts to show the actual values. My problem is that one of the fields...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.