chazewalker
New Member
- Joined
- Jun 1, 2011
- Messages
- 1
hi! I'm new in here as well as in VBA programming...
I have an ADO connection on my excel to access, connection works fine but when i try to loop on the query, I got this error:
Run-time error '3705'
Operation is not allowed when the object is open.
I want the macro to retrieve data from access database by specific cells.
Help me plz..
here's my code:
thanks in advance!
I have an ADO connection on my excel to access, connection works fine but when i try to loop on the query, I got this error:
Run-time error '3705'
Operation is not allowed when the object is open.
I want the macro to retrieve data from access database by specific cells.
Help me plz..
here's my code:
Code:
startRow = 7
here:
rs.Open "SELECT * FROM tblSample WHERE item_name = '" & ActiveSheet.Cells(startRow, 2) & "'" '<<--here i got the error..
Do Until rs.EOF
ActiveSheet.Cells(startRow, 2) = rs.Fields(2).Value
ActiveSheet.Cells(startRow, 7) = rs.Fields(3).Value
ActiveSheet.Cells(startRow, 6) = rs.Fields(5).Value
rs.MoveNext
startRow = startRow + 1
Loop
GoTo here
thanks in advance!