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

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
Asked:
sureshotuk
  • 2
1 Solution
 
LBooleanCommented:
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
 
sureshotukAuthor Commented:

had to change

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
 
LBooleanCommented:
Youre welcome
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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