If function in access (1 Viewer)

jenascott

Registered User.
Local time
Today, 20:37
Joined
Oct 16, 2005
Messages
25
I am trying to get a query to return certain words if a swimming time matches a certain criteria

i have tried the if function, whi i know how to use in a spreadsheet

how do i achieve an if function/or equivalent in a database??

jen
 

AlanS

Registered User.
Local time
Today, 15:37
Joined
Mar 23, 2001
Messages
292
You could put something like this in the query's SELECT clause:

IIf([SwimmingTime] = Forms!MyForm!txtSwimTime, "It matches", "No match") AS SwimText

which would cause the query to return a field called SwimText, with a message indicating whether or not each record's SwimmingTime field was equal to the value in the txtSwimTime field on the form MyForm.
 

jenascott

Registered User.
Local time
Today, 20:37
Joined
Oct 16, 2005
Messages
25
I tried this but my query came up with no data
this is what i put
IIf([minoftime]<=[national standard],"National","")
 

AlanS

Registered User.
Local time
Today, 15:37
Joined
Mar 23, 2001
Messages
292
Are you sure that [minoftime] and [national standard] are both present in the table(s) the query is based on, and that they are spelled correcrtly?
 

jenascott

Registered User.
Local time
Today, 20:37
Joined
Oct 16, 2005
Messages
25
AlanS said:
Are you sure that [minoftime] and [national standard] are both present in the table(s) the query is based on, and that they are spelled correcrtly?


well yes, though the min of times is a sorted field in another query
 

AlanS

Registered User.
Local time
Today, 15:37
Joined
Mar 23, 2001
Messages
292
Then I'd take a look at the data the query is returning, so you can see the actual values of the fields in question.
 

Users who are viewing this thread

Top Bottom