The Recordset object needs to be told what Connection to use. If you've got
an existing Connection object open, you can use that, but you still must
associated that Connection object to the Recordset object you're creating in
your routine.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Thanks
>
[quoted text clipped - 51 lines]
> > >
> > > Alvin
If your code and data (or linked tables) are in the same MDB or ADP, you can
use CurrentProject.Connection. For example ...
Public Sub ListData()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM Classification", CurrentProject.Connection
Do Until rst.EOF
Debug.Print rst.Fields(0)
rst.MoveNext
Loop
rst.Close
End Sub
Otherwise, when the code is execting in an MDB or ADP that does not contain
or link to the data, you need to create and open the connection, much as you
would in ASP ...
Public Sub ListExternalData()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\Microsoft
Office\OFFICE11\SAMPLES\Northwind.mdb;" & _
"Persist Security Info=False"
cnn.Open
Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM Employees", cnn
Do Until rst.EOF
Debug.Print rst.Fields(1)
rst.MoveNext
Loop
rst.Close
cnn.Close
End Sub

Signature
Brendan Reynolds
Access MVP
> Thanks
>
[quoted text clipped - 51 lines]
>> >
>> > Alvin
alvin Kuiper - 06 Feb 2006 21:33 GMT
Sorry i find out hoq
rst.Fields("sjov")
so thanks for your help
Alvin
> If your code and data (or linked tables) are in the same MDB or ADP, you can
> use CurrentProject.Connection. For example ...
[quoted text clipped - 93 lines]
> >> >
> >> > Alvin
alvin Kuiper - 06 Feb 2006 21:34 GMT
Thanks
Now i understand
Just one more if you can help
In my table i have a field name: "sjov"
then i want to see what in this fild
and in my way i want to write
rst.sjov
But this don't work????
Best regards alvin
and thanks for the help
> If your code and data (or linked tables) are in the same MDB or ADP, you can
> use CurrentProject.Connection. For example ...
[quoted text clipped - 93 lines]
> >> >
> >> > Alvin
SteveS - 07 Feb 2006 09:38 GMT
Try using bang (!), instead of dot (.): rst!sjov
I think you can also use: rst.Fields("sjov")

Signature
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
> Thanks
> Now i understand
[quoted text clipped - 109 lines]
>>>>>
>>>>>Alvin