Using Columns in where clause (1 Viewer)

Mr_Si

Registered User.
Local time
Today, 04:45
Joined
Dec 8, 2007
Messages
163
I have a query which is simply 1 field, but that field contains 6 columns (obviously numbered 0 - 5).

Now I want to use a where clause so that the 4th column (or rather, column 3) is equal to a particular criteria.

What is the syntax for this?

The SQL code from the standard query with NO where clause is:

Code:
SELECT tblEntrantLookup.lngzEntrantID
FROM tblEntrantLookup;
However, I want to do this in VBA and open a form based on the new result.

When I use the following WHERE Clause:

Code:
WHERE tblEntrantLookup.lngzEntrantID.column(3) = 1

it doesn't work! It gives me a message regarding an undefined function.


How do I do this?

Thanks,
Simon
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 20:45
Joined
Aug 30, 2003
Messages
34,830
You'd simply refer to the field name:

WHERE Field3 = 1
 

Mr_Si

Registered User.
Local time
Today, 04:45
Joined
Dec 8, 2007
Messages
163
I tried that but it still returned all the results, so it's sadly not working.

Maybe I need to explain further.

Ok, so I have a table called tblEntrantLookup, which has simply got 1 field in called "lngzEntrantID", that is a lookup to a query as follows:

Code:
SELECT [qryEntrantPerson].[idsEntrantID], [qryEntrantPerson].[numEntrantNo], [qryEntrantPerson].[lngzPersonID], [qryEntrantPerson].[lngzShow], [qryEntrantPerson].[idsPersonID], [qryEntrantPerson].[Name] FROM qryEntrantPerson;
Now I want to make a new query where only the results relating to where [qryEntrantPerson].[lngzShow] a certain ID, such as 1.


but of course now, it's just a single field with 6 columns...
 

Mr_Si

Registered User.
Local time
Today, 04:45
Joined
Dec 8, 2007
Messages
163
Ok, I *think* the problem was actually in the first query "qryEntrantPerson". I've just tried something and it seems to be working now. We shall see.
 

Users who are viewing this thread

Top Bottom