Table names in recordsets?

  • Thread starter Thread starter Bully
  • Start date Start date
B

Bully

If I have an SQL call e.g. SELECT * FROM Customers

In the returned recordset, how to I access the data with the table
name e.g.

rs("Customers.ID")
rs("Customers.Name")
rs("Customers.Address")

I can only get it to work without the table name e.g.

rs("ID")
rs("Name")
rs("Address")

My SQL string can change at runtime, and I may have duplicate field
names so I want to make sure I'm accessing the correct field from the
correct table.

Thanks
Jon
 
Then why not alias the duplicate field names in your SQL?

Alternatively, you can refer to the fields by number (rs(0), rs(1),...) and
then get the name of the field that way.
 
Then why not alias the duplicate field names in your SQL?

Alternatively, you can refer to the fields by number (rs(0), rs(1),...) and
then get the name of the field that way.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)








- Show quoted text -

The field names can be created by a user at runtime, and the SQL is
constructed dynamically at runtime, so I don't know what order the
fields come in as. The field names could be in German, Japanese etc.

Jon
 
Back
Top