ADDING TWO FIELDS .

nia44

New member
Local time
Today, 16:36
Joined
Dec 11, 2000
Messages
6
WE NEED TO ADD TWO FIELDS ON A FORM
nUMBER OF ADULTS AND NUMBER OF CHILDREN
AND HAVE THAT VALUE ENTERED INTO FIELD TOTAL NUMBER OF MEMBERS
 
Hello!

Create a control on your form. In the Data source of the control, type the following:

=[Adults]+[Children]

(assuming that "Adults" and "Children" are the names of the other fields.)

You could also put that same expression in a query. In the top row of the query, type:

Total:=[Adults]+[Children]

Then you'll have this value to use in any form or report without retyping.

Hope this helps,

Dan
 
You may want to include the val functions so that Access doesn't try to string the two numbers together instead of adding them.

Total = Val([Adults]) + Val([Children])
 
You should not save the result of adding the two fields together in a field in your table. This is a programming "No,No". This would make your result "static". If the number of children or the number of adults should change in the future, the saved result would not be correct. You can get the result anytime you need it by again adding the stored entries "on the fly". This will result in receiving the correct answer always.

Just a thought,
RDH

[This message has been edited by R. Hicks (edited 12-15-2000).]
 

Users who are viewing this thread

Back
Top Bottom