forms

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Forms

Forms

resolvedResolved · Low Priority · Version 2003

Sinal has attended:
Access Intermediate course
Access Advanced course

Forms

how to use different formulas

RE: Forms

Hello Sinal,

there are various ways to use formulas. One of the easiest examples to use is an on form formula. If you have a tabular form that shows more than one record on the form and you have a field that is numerical, for example Price then you can easily get a total of what is on the form by doing the following.

Go to design view and add a text box into a convienient space (you might be able to create space if need be by pulling out a bit of form space from the bottom edge of the footer bar). The text box you have created will currently be showing 'Unbound'. Over-write this with =Sum([Price]). Go to form view and you will see the total. You can use the label appropriately to show Total Value etc. If your field is not Price then put what ever its name is as it appears in design view on the form. The curve brackets is the way to use the Sum function--it tells Access to do a sum on what is in the brackets. The square brackets tells Access to look for a field name. You can alter the above equation or create a further text box as required, to do a different calculation. For example you may need to add VAT at 17.5% so you would insert =(Sum([Price]))*1.175

You can multiply two fields within a query to add a new column showing results against each record. If the field names are Quantity and Price then you would type into a new blank column in the query desing grid (a query having Quantity and Price columns in it). You would type into the top row the following. Total: ([Quantity]*[Price]) In this example you don't need sum because it is just a multiplication within each record line. I have mentioned Sum as an operator but there are many others available, which you can see via Help when you have Access open.

I hope this was helpful.
Mark

RE: Forms

Hi Sinal,

To add a little bit to Mark's useful response, formulas in Access are usually built either in queries or on Forms and Reports, if you are comfortable with the syntax of a formula you can type it directly into the field (Ab) from the Toolbox, or you can use the Expression Builder.

Using the Expression Builder gives you access to many different functions and formulas and enables you to 'build' your required calculation into the field. If you open the Expression Builder and check out the Functions option (double click on it) you will see a number of formulas for you to choose from.

You will know what type of calculation you are hoping to achieve, the Functions option will give you the formula to apply it.

I hope that has helped, regards Pete


 

Access tip:

Create An Inaccessible Field On A Form

There is sometimes a need to make a field in a form look like a normal field but be completely inaccessible to the user. To do this:

In the Field's Properties
Set the ENABLED property to No
Set the LOCKED property to Yes

The field will not grey out, but the user will not be able to do anything with it.

View all Access hints and tips


Server loaded in 0.1 secs.