switch funtion

E

Effie

I'm doing a switch function within a query grid. The expression is:
Switch([fieldA] Is Not Null,
[fieldA],[fieldB]="string1",2.5,[fieldB]="string2",10)

where fieldA contains number data and fieldB contains text data. I want
this expression to give me a column of numbers, but the expression is
spitting out the numbers as text ... the resulting column when I view the
query has the numbers justified to the left-hand margin of the column,
indicating that it's returning them as text. Is there some argument to add
to the switch function to have it return these values as numbers?
 
D

DanRoss

= CDbl(Switch([fieldA] Is Not Null,
[fieldA],[fieldB]="string1",2.5,[fieldB]="string2",10))

Or CInt or CDec or . . . .
 
S

Steve Schapel

Effie,

Ise the Val() function to convert text to number, e.g.
Val(Switch([fieldA] Is Not
Null,[fieldA],[fieldB]="string1",2.5,[fieldB]="string2",10))
 

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