Question understanding a line of code

  • Thread starter Thread starter Victoria
  • Start date Start date
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
 
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.
 
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)
 
Back
Top