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?