473,503 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.CurrentProject.Connection

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
1 10381
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4741
by: Steve Morris | last post by:
Why does CurrentProject.Connection.Execute "qryStoresImport5ToStage", RecordsAffected, adCmdText return the error: Run-time error'-2147217900(80040e14)': Invalid SQL statement; Expected...
3
12574
by: Ol!v!é | last post by:
I have an ADP Project in MsAccess XP, with an MSSQL-backand (MSDE). I would like to set the Connection of the project from VBA, so all the forms and reports can use it. Normally, I set this...
7
4418
by: lauren quantrell | last post by:
Wondering if anyone has already written a snippet that will loop through every form, report, module in an ADP application and do application.SaveAsText on each item.
6
8559
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
6
13474
by: alex.hatzisavas | last post by:
Hi all. I'm having a serious problem when i'm trying to use the CurrentProject.Connection property for some ADO manipulation. Here's the error message i'm getting: Run-time error...
3
1806
by: John Phelan-Cummings | last post by:
I have a front-end application called, “inbusiness.mdb” and three back-ends databases called, “inbusinessClient_be.mdb”, “inbusinessFund_be.mdb”, and, “inbusiness_be”. I created three back-ends...
0
1838
by: cyberdwarf | last post by:
Hi y'all I like to be able to trap the OnClose event for the CurrentProject.Connection in my ADE. As this is a very large project, I can't see where, or how I should insert the code to...
0
2197
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
5
9264
by: akirekab | last post by:
Can this be saved somehow in a field in the database along with some other address criteria, so I can always be looking at the current location. like this? ...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.