Solved

# Mathmatical Functions In Fields Of Table

Posted on 2003-03-20
Medium Priority
345 Views
(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
Question by:sureshotuk
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 1

Accepted Solution

LBoolean earned 200 total points
ID: 8174502
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

LVL 1

Author Comment

ID: 8174940

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

LVL 1

Expert Comment

ID: 8175798
Youre welcome
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
###### Suggested Courses
Course of the Month11 days, 16 hours left to enroll