ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Promlems with DAO (https://www.excelbanter.com/excel-programming/309918-re-promlems-dao.html)

Rob Bovey

Promlems with DAO
 

Try:

Cells(1,1) = RS1.Fields(FieldName)

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"djEsko" wrote in message
...
I'm trying to get some data from Access database. The code is following.

Set RS1=DB1.OpenRecordset("SELECT * FROM TestTable")
Do Until RS1.EOF
Cells(1,1)=RS1!Field1
RS1.MoveNext
Loop

Instead on RS1!Field1 I would like to use a variable, which has the name

of
the field.

E.g.
FieldName="Field1"
Cells(1,1)=RS1! & Field <- This is not working.

Any ideas?





All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com