Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a calculation - should be easy

Status
Not open for further replies.

mbutler55

Instructor
Feb 5, 2003
33
US
I am NOT an expert in Access and don't even pretend to be, so don't hesitate to "dumb-down" your answers. You will not insult me!

Here goes:
In a table I have 2 fields both of which are numbers - YEAR and MONTH

Now I want to calculate the duration using the formula YEAR + MONTH / 12. I THINK I have to do this in a FORM. So in the FORM I created a "field" using the TEXT BOX option and on the DATA tab for the CONTROL SOURCE and the DEFAULT VALUE I have = YEAR + MONTH / 12. I did the same thing using the OPTION GROUP tool. So far nothing is coming up with a value in this field so OBVIOUSLY I am doing something wrong and my intuition is not working.

Can someone point me in the right direction?
 
mbutler,
The main problem I see is your field names.
"Month" and "Year" are reserved words.
Change the names to mymonth, myyear or something and I bet your calc will work.
When I first started Access and got blank results in a field I would try separate calculations in the text box to see if my data was valid.
control source
=[year]
then I would put
=[month]
if they came up with data separately then I knew that somewhere, usually in the "table data type" I had entered "text"
Jim
 
mbutler55,

I don't think Year and Month are reserved words. They are very generic and not the best field names but they should work. I see a couple of problems. You don't have to do this in a form this calculation can be done in a query. Just type something like NewCalculation:([Year]+[Month])/12 in the "field" section of a blank grid. Also, I'm not sure what you want this to calculate, but all it is doing is adding the year (let's say the year is 2003) and the month (2?) and dividing it by 12. Using these values the total would be 167. I don't think this is what you want. Let me know what you really want to calculate and I may be able to help further.

Julia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top