Question understanding a line of code

V

Victoria

hi - I'm working through examples of code, learning what I can. In Allen
Browne's web site, there is a 'Function ShowFieldsRS(strTable)'. I'm trying
to understand the purpose of the 'False' in the code fragment below.

strSql = "SELECT " & strTable & ".* FROM " & strTable & " WHERE (False);"

The code works perfectly, but I don't understand why. I would have thought
that 'WHERE(False)' would allow no records to be chosen.

just wonderin'
Victoria
 
D

Dirk Goldgar

Victoria said:
hi - I'm working through examples of code, learning what I can. In Allen
Browne's web site, there is a 'Function ShowFieldsRS(strTable)'. I'm
trying
to understand the purpose of the 'False' in the code fragment below.

strSql = "SELECT " & strTable & ".* FROM " & strTable & " WHERE
(False);"

The code works perfectly, but I don't understand why. I would have
thought
that 'WHERE(False)' would allow no records to be chosen.


Opening a recordset on the constructed SQL statement will result in an empty
recordset containing all the fields from the table named by strTable. There
will be no records in the recordset, but it can be used to find out what
fields are in the table. I'm not familiar with the function you mention,
but its name suggests that its purpose is to do just that: list the fields
in the table -- not the data in the fields, but the names (and maybe the
properties) of the fields.
 
V

Victoria

Dirk - yes, that makes sense. Thanks!

Dirk Goldgar said:
Opening a recordset on the constructed SQL statement will result in an empty
recordset containing all the fields from the table named by strTable. There
will be no records in the recordset, but it can be used to find out what
fields are in the table. I'm not familiar with the function you mention,
but its name suggests that its purpose is to do just that: list the fields
in the table -- not the data in the fields, but the names (and maybe the
properties) of the fields.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 

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