• Status: Solved
• Priority: Medium
• Security: Public
• Views: 355

# Mathmatical Functions In Fields Of Table

(Access '97, Win '98)

I'm hoping this is fairly simple... let's see : )

I have a pool of tickets to be given away, people can apply for upto 10 but only the first 4 are guaranteed.  The rest are put into a draw and may or may not be received.

To represent this in the Access Db I have built for the people answering the ticket lines what i want to do is this:

Have one input box into which the user will type in the total number of tickets ordered (say 10), there should then be a further field which displays the number that hence need to be put into the draw (10 - 4 (the guaranteed tickets)).

The field name of the tickets ordered field is fldTicOrd.  I thought about using the default value and putting it as fldTicOrd - 4 but am not sure of the syntax to this.  Could anyone inform me?  Also is there a better way to do this?

Thanks in advance for any help.

Regards,

SS

0
sureshotuk
• 2
1 Solution

Commented:
Hi sureshotuk,
firstly, this is probably better handled in a form than in a table. If you need to see the data as a table (visually) then you can open the form in the 'datasheet' view.

So, given you are working in a form, you can set the default value of the textbox object (lets call this fldDraw) where the calculation is stored to =[fldTicOrd]-4

also, it may be wise to include an after update event for the object fldTicOrd. something like this

Private Sub fldTicOrd_AfterUpdate()
Me![fldDraw] = Me![fldTicOrd] - 4
End Sub

hope this helps you

L
0

Author Commented:

Me![fldDraw] = Me![fldTicOrd] - 4

to

[forms]![me]![fldDraw] = [forms]![me]![fldTicOrd] - 4

but apart from that this worked fine.

thanks and regards,

ss
0

Commented:
Youre welcome
0

## Featured Post

• 2
Tackle projects and never again get stuck behind a technical roadblock.