access calculating machine

P

problem

I want to make a calculating machine.

IF i have a score, i want this value become a string

e.g.
if [num]>80 and <100 = "A"
if [num]>70 and <79 = "B"
..
..
..
how to make the string out ?
 
J

Jeff Boyce

One approach would be to write a function that accepts a numeric input and
returns a character output. You could use a series of If... Then statements
or a Select Case ... statement in the function.

Just one person's opinion...

Jeff Boyce
<Access MVP>
 
P

problem

in excel, i can do it easily~
but in Acces, i can't do anything.....coz i dun know how to make the code in
the function....

so ....you can help me?
THX !


Jeff Boyce said:
One approach would be to write a function that accepts a numeric input and
returns a character output. You could use a series of If... Then statements
or a Select Case ... statement in the function.

Just one person's opinion...

Jeff Boyce
<Access MVP>

problem said:
I want to make a calculating machine.

IF i have a score, i want this value become a string

e.g.
if [num]>80 and <100 = "A"
if [num]>70 and <79 = "B"
.
.
.
how to make the string out ?
 
J

Jeff Boyce

It might "help you" more to spend a little time looking at Access HELP on
the topics of If ... Then and Select Case functions.

The generic approach would be to create a new code module, use one of these
(or other) functions to accomplish what you want, close/compile, then call
the function from whatever you are working on (?perhaps a query?).

If this seems like way too much work, is there a reason you don't just use
what you already know how to do ... carry this out in Excel?

--
Good luck

Jeff Boyce
<Access MVP>

problem said:
in excel, i can do it easily~
but in Acces, i can't do anything.....coz i dun know how to make the code in
the function....

so ....you can help me?
THX !


Jeff Boyce said:
One approach would be to write a function that accepts a numeric input and
returns a character output. You could use a series of If... Then statements
or a Select Case ... statement in the function.

Just one person's opinion...

Jeff Boyce
<Access MVP>

problem said:
I want to make a calculating machine.

IF i have a score, i want this value become a string

e.g.
if [num]>80 and <100 = "A"
if [num]>70 and <79 = "B"
.
.
.
how to make the string out ?
 
J

Jamie Collins

Jeff Boyce said:
One approach would be to write a function that accepts a numeric input and
returns a character output. You could use a series of If... Then statements
or a Select Case ... statement in the function.

This could be done in SQL code using the ready-rolled SWITCH function e.g.

SELECT SWITCH(
MyIntCol>=80 AND MyIntCol<100, 'A',
MyIntCol>=70 AND MyIntCol<80, 'B'
) AS my_text
FROM MyTable

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top