Table names in recordsets?

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
 
D

Douglas J. Steele

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.
 
B

Bully

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
 

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