Sql filter for MS Access?

A

antonyliu2002

As a practice, I am working on a todo list web application.

I have MS Access database called Tasks.mdb, which contains a simple
table called Tasks that looks like so:

TaskID Name Completed
0 Create DB Yes
1 Build Web No
2 Enable AJAX No
3 Write Doc No

In the video, they have a SQL query like this:

Select TaskID, Name, Completed from Tasks where Completed=@IsComplete

It seems that IsComplete is a function that'll return either "Yes" or
"No". So this single query is pretty much like two queries below:

Select TaskID, Name, Completed from Tasks where Completed="Yes"
Select TaskID, Name, Completed from Tasks where Completed="No"

I need to use this feature with ACCESS, but it looks like ACCESS cannot
recognize "@".

So, how do we do this in MS Access? Anyone can give a hint? Thanks.
 
6

'69 Camaro

Hi, Antony.
I need to use this feature with ACCESS, but it looks like ACCESS cannot
recognize "@".

Access doesn't need to. That's the T-SQL syntax for a local variable. Jet
supports variables, but one doesn't need to prefix the variable with a special
symbol.

Have you tried the following query to return all records of tasks that are
either completed or not?

Select TaskID, [Name], Completed from Tasks;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
 
A

antonyliu2002

'69 Camaro said:
Hi, Antony.
I need to use this feature with ACCESS, but it looks like ACCESS cannot
recognize "@".

Access doesn't need to. That's the T-SQL syntax for a local variable. Jet
supports variables, but one doesn't need to prefix the variable with a special
symbol.

Have you tried the following query to return all records of tasks that are
either completed or not?

Select TaskID, [Name], Completed from Tasks;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.

Thanks, yes, I've figured it out.
 
6

'69 Camaro

You're welcome, Antony. Good luck.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


'69 Camaro said:
Hi, Antony.
I need to use this feature with ACCESS, but it looks like ACCESS cannot
recognize "@".

Access doesn't need to. That's the T-SQL syntax for a local variable. Jet
supports variables, but one doesn't need to prefix the variable with a
special
symbol.

Have you tried the following query to return all records of tasks that are
either completed or not?

Select TaskID, [Name], Completed from Tasks;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.

Thanks, yes, I've figured it out.
 

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