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

Application.CurrentProject.Connection

P: n/a
Hello all,

I had a database in MS Access 2003 which I converted to Access 97. The
"CurrentProject" object causes an error in the code that was
automatically written by Access when I created the original database. I
have researched and this object is only available in version 2000 and
later. I need to get rid of the reference to "CurrentProject" and
replace it with something that will work in Access 97. Here's what the
code looks like:

Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [Switchboard Items] "
stSql = stSql & "WHERE [SwitchboardID]=" & Me![SwitchboardID] & "
AND [ItemNumber]=" & intBtn
rs.Open stSql, con, 1 ' 1 = adOpenKeyset

Any help is much appreciated.
Thanks for reading.
Carmela

Jul 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"ca**********@hotmail.com" <ca**********@hotmail.comwrote in message
<11**********************@h48g2000cwc.googlegroups .com>:
Hello all,

I had a database in MS Access 2003 which I converted to Access 97.
The "CurrentProject" object causes an error in the code that was
automatically written by Access when I created the original database.
I have researched and this object is only available in version 2000
and later. I need to get rid of the reference to "CurrentProject" and
replace it with something that will work in Access 97. Here's what
the code looks like:

Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [Switchboard Items] "
stSql = stSql & "WHERE [SwitchboardID]=" & Me![SwitchboardID] & "
AND [ItemNumber]=" & intBtn
rs.Open stSql, con, 1 ' 1 = adOpenKeyset

Any help is much appreciated.
Thanks for reading.
Carmela
I think you should be able to replace it with something like this

dim db as dao.database
dim rs as dao.recordset

set db = currentdb
' build the sql ...
set rs = db.openrecordset(strSql)

' the close and release at the end of the routine
rs.close
set rs = nothing
set db = nothing

--
Roy-Vidar
Jul 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.