Simple Query Question - Restricting numbers to be Integers

n107jkx

Board Regular
Joined
Dec 3, 2002
Messages
51
I have two fields:

[Mark_Achieved] and [Maximum_Mark]

in linked tables. In a simple query, I used:

Percentage: ([Mark_Achieved]/[Maximum_Mark])*100

to compute a percentage, however, if the score is, for example, 11 out of 32, the percentage calculated is 34.375.

Can anybody find a way I can restrict the value to be an integer only?

(I have tried using update queries to update a percentage field in a table, but this is something i would rather not have to do, as i will keep having to update figures in the forms where they will be used)
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Re: Simple Query Question - Restricting numbers to be Intege

In the Query Design view, right-click on the column where you have the Percentage field, choose Properties and change the Format to 0.
 
Upvote 0
Re: Simple Query Question - Restricting numbers to be Intege

Thanks thats great.

Can you explain to me how that works - what does the zero stand for?

If I can understand it I may be able to apply it to other areas of the database.

Thanks (y)
 
Upvote 0
Re: Simple Query Question - Restricting numbers to be Intege

It's just a formatting code, if you'd used '0.0' you would have got it to one decimal place, '0.00' to two decimal places etc.
 
Upvote 0
Re: Simple Query Question - Restricting numbers to be Intege

Thank you. I have another problem though.

Having created a query to bring up all of the students scores as separate records - i.e. the title of the work, date set, mark achieved and the rest, i set the criteria as [Enter Student Number]. I have converted this query into a tabular form successfully, but I would like a combo box to be able to choose the student from a list of names in my table and this to bring up their results.

I have tried in vain liking the combo box to the Student_number field in the query, but Access does not like it.

Any help would be greatly appreciated, thanks.

:rolleyes: :rolleyes: :rolleyes:
 
Upvote 0
Re: Simple Query Question - Restricting numbers to be Intege

You need to set up a form that's based on the query. In the form, in design view, add a combo box with the wizards turned on. I think it's the first screen that comes up where you choose to "look up information based on the choice in the combo box", or something like that. Go through the rest of the wizard and choose the correct fields and such, and it should work.
 
Upvote 0

Forum statistics

Threads
1,221,581
Messages
6,160,630
Members
451,661
Latest member
hamdan17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top