473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Cur rentProject.Con nection

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.Cur rentProject.Con nection
Set rs = CreateObject("A DODB.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 10415
"ca**********@h otmail.com" <ca**********@h otmail.comwrote in message
<11************ **********@h48g 2000cwc.googleg roups.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.Cur rentProject.Con nection
Set rs = CreateObject("A DODB.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.openrecordse t(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
4768
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 'DELETE','INSERT','PROCEDURE','SELECT, OR 'UPDATE'. but Dim SQL As String SQL = "INSERT INTO StoresStage ( StoreNumber, StoreName,
3
12600
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 through the File->Connection menu, but if the network connection falls away for a moment, I have to reconnect manually. I would like to reconnect automatically with VBA. I've tried using CurrentProject.Connection.Open and...
7
4436
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
8572
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 fine All SQL Servers I am referring to share a small (10 computers or so) LAN with a 100MB Switch. No other computers on the LAN exhibit this problem.
6
13485
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 '-2147220999 (800401f9)': Method 'Connection' of object '_CurrentProject' failed
3
1813
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 for the potential intensive use of certain areas of the front-end application to their back-end tables by certain type of organizations. With the code below, (used to make future front-end updates
0
1848
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 reconnect to the SQL server if the connection is lost when the user is away from the workstation for a while..... Anyone got any ideas? All help greatly appreciated
0
2213
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 Server 2000 We are having some problems with a website we are developing, and had some
5
9308
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? Application.CurrentProject.Path\year\month\nbr 9.jpg and when pulled out, you get C:\Folder1\year\month\nbr 9.jpg with C:\Folder1 being the current path
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5647
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.