switching two cells in a row

damcloodt

Registered User.
Local time
Today, 16:58
Joined
Sep 23, 2008
Messages
16
Hello,

I have a dataset in which there are two columns with numbers in it.
For instance:

Column A Column B
12 25
34 17
67 80

Now, in each row, I want to have the smallest number in column A and the largest in column B, so that I get the following table:

Column A Column B
12 25
17 34
67 80

Is there any way to do this using a query?

Thank you so much in advance for all your help!!!

Kind regards, Daniëlle
 
add extra columns for

"highest" and "lowest"

then do queries to set highest, lowest, then copy them back

THEN - make sure your input sorts them correctly in the first place

-------
or you could do it a row at a time with code, by iterating a recordset
 
Dear Gemma,

How can i do a query to set "highest" nad "lowest"?
How should i for instance performe a query to set "highest" (out of the two columns per row)???

Thanks, Daniëlle
 
upadte query

update the "highest" column

if (a>b, a, b)

etc
 
but where should i put this if-function then?

i normally use creating query in design view, can i put this if-function somewhere in the grid?
 
you can put that as a new field in your query and you should use the iif

iif(a>b, a, b)
 
the programme Access does not regonize "if" ?
I use: maek a query in design view and addes the if-function in the field like this:
if([case1]>[case2], [case1], [case2]) but it does not work?

did I enter the if in the right field?
 
sorry my mistake

if in code, if condition then action

but iif (immediate if) inline in queries iif(condition,actiona,actionb)
 

Users who are viewing this thread

Back
Top Bottom