By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,561 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

ADO from within ms access

P: n/a
Dear all,

I have a form within the forms tab of my .mdb file with combo boxes
filled with data from my master tables. The user needs to select his
choice from these combo boxes and press the Go button. the GO_click
event is supposed to open a recordset based on the parameters provided
by the user.

My question: how do i set the activeconnection property of the
recordset? creating a connection object with full path of db is
returning an error saying that the database is locked for use.

I have seen that is case of dao, currentdb object is used to set the
database. what is the procedure in ADO.

Please help!!
Thanks in advance,
Yash Poddar

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
CurrentProject.Connection should return the current active
connection.

So you could use something like:

Dim cn As ADODB.Connection
Dim rst As ADODB.Recordset

Set cn = CodeProject.Connection
Set rst = New ADODB.Recordset

'blah blah blah

rst.Open YourTableName, cn, adOpenStatic, adLockPessimistic,
adCmdTableDirect

'blah blah blah

'And put the following in just before the end to ensure
everything is closed properly

If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
If Not cn Is Nothing Then
Set cn = Nothing
End If

--
Nick Coe (UK)
http://www.alphacos.co.uk/
pAnimal - Pedigrees and Breeding - Free 30 day trial
AccHelp - Skeleton Help for Access Apps
http://www.pjandcoe.co.uk TShirts with Bark factor... :-)
In
news:11**********************@f14g2000cwb.googlegr oups.com,
Yash typed:
Dear all,

I have a form within the forms tab of my .mdb file with
combo
boxes filled with data from my master tables. The user
needs
to select his choice from these combo boxes and press the
Go
button. the GO_click event is supposed to open a recordset
based on the parameters provided by the user.

My question: how do i set the activeconnection property of
the
recordset? creating a connection object with full path of
db is
returning an error saying that the database is locked for
use.

I have seen that is case of dao, currentdb object is used
to
set the database. what is the procedure in ADO.

Please help!!
Thanks in advance,
Yash Poddar

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.