473,666 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! Public variable not staying set - 3420 Object invalid or no longer set.

HELP!
Hi Folks,

I'm having trouble referencing these public variables, and I'm not sure
why. I use the code below to set open a connection to a database. The
variables are public variables and I hadn't had any problems previously, but
I seem to be having trouble now. I could have modified it between the time
it last worked and now (while I was cleaning up some of the code) but I
don't recall touching anything.

Right after I call this code, I do a
Debug.Print db.Name

and that throws the error
"3420 Object invalid or no longer set".

I've been beating my head against the wall wondering why this is. Any
ideas?

Thanks!

Public wksp As DAO.Workspace
Public db As DAO.Database

Function connectMyDb(Opt ional strlocation As String) As Boolean
On Error GoTo connectMyDb_Err

If strlocation = "" Then strlocation = getAttachment() ' If there is no
location specified, then get an attachment from existing attachments

DBEngine.System DB = "system.mdw "

Set wksp = CreateWorkspace ("ModifyDb", "Admin", "", dbUseJet)

Set db = wksp.OpenDataba se(strlocation, False, False, ";pwd=" &
GetPassword())

connectMyDb = True

connectMyDb_Exi t:
Exit Function

connectMyDb_Err :
If Err.Number = 3031 Then
'If this error is thrown, the user has entered a password on his or her
own database
SetCustomPasswo rd
Resume
ElseIf Err.Number = 3051 Then
'MsgBox "Data file is read only. Cannot continue", vbCritical, "Read
Only Data file"
Resume connectMyDb_Exi t
Else
MsgBox Err.Number & ": " & Err.Description , vbCritical, "Error
Connecting"
Resume connectMyDb_Exi t
End Function

Dec 14 '05 #1
1 2420
Anybody at all?

"Jozef" <me@you.com> wrote in message news:4qLnf.1475 37$S4.28702@edt nps84...
HELP!
Hi Folks,

I'm having trouble referencing these public variables, and I'm not sure
why. I use the code below to set open a connection to a database. The
variables are public variables and I hadn't had any problems previously,
but I seem to be having trouble now. I could have modified it between the
time it last worked and now (while I was cleaning up some of the code) but
I don't recall touching anything.

Right after I call this code, I do a
Debug.Print db.Name

and that throws the error
"3420 Object invalid or no longer set".

I've been beating my head against the wall wondering why this is. Any
ideas?

Thanks!

Public wksp As DAO.Workspace
Public db As DAO.Database

Function connectMyDb(Opt ional strlocation As String) As Boolean
On Error GoTo connectMyDb_Err

If strlocation = "" Then strlocation = getAttachment() ' If there is no
location specified, then get an attachment from existing attachments

DBEngine.System DB = "system.mdw "

Set wksp = CreateWorkspace ("ModifyDb", "Admin", "", dbUseJet)

Set db = wksp.OpenDataba se(strlocation, False, False, ";pwd=" &
GetPassword())

connectMyDb = True

connectMyDb_Exi t:
Exit Function

connectMyDb_Err :
If Err.Number = 3031 Then
'If this error is thrown, the user has entered a password on his or her
own database
SetCustomPasswo rd
Resume
ElseIf Err.Number = 3051 Then
'MsgBox "Data file is read only. Cannot continue", vbCritical, "Read
Only Data file"
Resume connectMyDb_Exi t
Else
MsgBox Err.Number & ": " & Err.Description , vbCritical, "Error
Connecting"
Resume connectMyDb_Exi t
End Function


Dec 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
6531
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
9
4398
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
6
4332
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
6
3006
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect an html authoring tool to help you accomplish? 2. What do you expect from online help for a html authoring tool? 3. What audience do you think a freeware html authoring tool is directed towards?
2
3935
by: BT Openworld | last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject) doesn't work when loaded on Windows XP. I'm finding my way around Access 2003 but my biggest problem is getting information. When I bought Access 1.0 many years ago, I got a paper manual and an excellent help file with all you needed to know. With Access 97 the manual came as a 'Building Applications' document on the CD and I still had the excellent help. With Access...
7
5369
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
5
3261
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time using "F1" help within the VB IDE. Is this expectation achievable In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
8
3222
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both including search the internet for help, but the help is worthless. Any ideas?
10
3352
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably the worst I ever seen. I almost cannot find anything I need, including things I
0
2877
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
8443
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
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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...
0
7385
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
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
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
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
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.