How to multiply values in a form (1 Viewer)

seamusnboo

Registered User.
Local time
Today, 05:05
Joined
Jul 28, 2004
Messages
20
Hi. I'm new to Access and I wonder if someone could help me with this problem I am having while constructing a database. We need to create a database of reservations to a program we offer. We will need to store the quantity of reservations per person. What we needed to do is multiply the quantity of reservations by the value of each reservation and get a 3rd field with the final amount. So we need a field with the result of the multiplication of the quantity of reservations by the value of each reservation, which is a fixed amount. I'm having problems getting access to do this, I get an "error" message on the resulting field. Can somebody help me with this?

Thanks.
 

oldaf294

Registered User.
Local time
Today, 13:05
Joined
Mar 29, 2002
Messages
91
values

Are you familiar with querys and forms?
1. According to DB standards you do not want to store calculated values.
2. It is easy to perform calculations in querys, forms and reports

For a query. Click on the "query tab", select "new", "simple query" and select the table that your info is in. Select all the fields you need.
In a blank query grid in the "Field" on the top line type;
Result: [quantityofreservationfield]*[amountofreservationfield]

That will give you a "field" without storing the information. You can use the "field" for forms, other querys and reports.
jim
 

seamusnboo

Registered User.
Local time
Today, 05:05
Joined
Jul 28, 2004
Messages
20
Ok, I did that, created the "Field" with a query. But now there's a problem. My main form has the Record Source being set as the main table. So when I put this query "field" on my form I get a field filled with "#Name?" in it. How do I make this query "field" work on my main form?
 

oldaf294

Registered User.
Local time
Today, 13:05
Joined
Mar 29, 2002
Messages
91
query example

For the computational entry you can leave "field:" as the name or change it to "result:" but you need to type the following, using the names of your fields where the brackets are [your field name].
type in a blank field

"Field:= [quantityofreservationfield]*[amountofreservationfield]"

Without the quotes. I just noticed, I forgot the "=" sign in the previous post...sorry
OR you can just type the
=[quantityofreservationfield]*[amountofreservationfield]
and a Exp: [quantityofreservationfield]*[amountofreservationfield]
will show up. Then you can change the "Exp:" to any name you want but include the colon.
I added an attachment with the query grid and my fields in the example..
jim
 

Attachments

  • query example.GIF
    query example.GIF
    32 KB · Views: 182

Users who are viewing this thread

Top Bottom