Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default ADO syntax problem

Hi!

I am using the following code to query access table. the code works fine. My
problem is how to name the field name ([Cell]) as a string, in order to use
this query as a dynamic query. I tried many things but nothing succeeded.

Thanks for your help!

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Documents and
Settings\Eli\My Documents\ETV_Cells.mdb"
rst.Open "SELECT * FROM CellTable ;", cnn, adOpenStatic
rst.MoveFirst
strCellCode = rst![Cell]

rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing


Eli
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 174
Default ADO syntax problem

Eli,

Declare a variable varCellCode as variant & varCellCode = rst.

Wkr,

JP


"???" wrote in message
...
Hi!

I am using the following code to query access table. the code works fine.
My
problem is how to name the field name ([Cell]) as a string, in order to
use
this query as a dynamic query. I tried many things but nothing succeeded.

Thanks for your help!

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Documents
and
Settings\Eli\My Documents\ETV_Cells.mdb"
rst.Open "SELECT * FROM CellTable ;", cnn, adOpenStatic
rst.MoveFirst
strCellCode = rst![Cell]

rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing


Eli



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default ADO syntax problem

strCellCode = rst.Fields("Cell").Value

Tim



"???" wrote in message
...
Hi!

I am using the following code to query access table. the code works fine.
My
problem is how to name the field name ([Cell]) as a string, in order to
use
this query as a dynamic query. I tried many things but nothing succeeded.

Thanks for your help!

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Documents
and
Settings\Eli\My Documents\ETV_Cells.mdb"
rst.Open "SELECT * FROM CellTable ;", cnn, adOpenStatic
rst.MoveFirst
strCellCode = rst![Cell]

rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing


Eli



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DAO Syntax Problem drinese18 Excel Programming 12 January 18th 08 02:54 PM
Syntax problem unknowndevice[_4_] Excel Programming 4 August 26th 05 10:57 PM
Syntax problem Alex H Excel Worksheet Functions 1 July 2nd 05 08:23 AM
Another Syntax Problem Sharlene England Excel Programming 2 December 2nd 03 10:04 PM


All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"