Solved

Error 3045

Posted on 2000-04-14
22
215 Views
Last Modified: 2010-05-18
I have this error at the end of my pgm.. Is there a way to find which recordset is opened again?
0
Comment
Question by:dosyl
  • 12
  • 10
22 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
Which instruction give you this error?

Is the message looks like "File in use"?
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
I run my pgm. i go only in the help File, i come back, i exit my pgm. I run again my pgm.(.exe on another machine) and now i have this error; the pgm.doesn't open.
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
I found the error but what to do. It is because i have my CommonDialog in Frmcli and to open the help file i use this commonDialog,and there is a dataControl in this form. Where i must to close this dataControl.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
To close the recordset of a DataControl you can use this:
Data1.Recordset.Close
Set Data1.Recordset = Nothing

But, normally, ending an application closes all the connection.

What is file on which you have problem? The help file or the database? Which statement makes you crash? Can we see a bit of code?
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
I know how to close a recordset. It crash because i put my commondialog in Form2 and i start with Form1. In talking with you i  believe i must to put my commondialog in the form1 to don't open Form2, because there is no Form_Unload if we use the commonDialog to open the help file and the pgm. doesn't show the Form2.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
But why is it working the first time?

0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
The first time it worked because the database was never opened. Once the database had being opened the DataControl on my Form2 was not close on the first time and the pgm. refuse to open it because it see the database opened.
I don't know if i'm enough clear.
P.S. In passing my name is Moreau.
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
For answering to my question; is there a way to find the opened recordset instead to do steps by steps(F8)?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
As soon as you have controls bound to your datacontrol, it is opened!

May I see your code? It will be easier!

Si ton nom est Moreau, tu dois parler français? D'où viens-tu?
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
Je viens tout près de Québec sur la Rive-Sud, Compté de Lotbinière.
Mon problème est réglé. La seule chose que je voudrais savoir c'est: y a-t-il un moyen avec VB de voir les recordset ouverts?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
What have you done to correct your problem?

The more you can do to know if a Recordset is open or not is:
Private Sub Command1_Click()
If Data1.Recordset Is Nothing Then
    MsgBox "nothing"
Else
    MsgBox "something"
End If
End Sub

Je viens de Richmond (entre Sherbrooke et Drummondville). J'ai beaucoup de parenté à Warwick (près de Victoriaville). Avons-nous des racines communes?

En passant e = Éric.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:dosyl
Comment Utility
I'd have like a better answer, to do what you said, i must to put code anywhere in the pgm.
To solve my error, i only put the CommonDialog in the Form1(the first form that appears).
Je ne connais pas de Moreau à Richmond, mais le monde est petit. Je passe assez souvent à Richmond, ma belle-mère reste à Sherbrooke.
Travailles-tu à ton compte?
Donald
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
«i must to put code anywhere in the pgm»
Can't you build a proc in which you pass your recordset byref than call your CommonDialog? This way it will be easy for checking if recordset is nothing!

Non je suis consultant pour Concept S2i (www.s2i.com) à Montréal.
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
I'd need an example, i cannot see how you check it. Code please,maybe. It is only to know for another time.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility

private sub Sub1(byref prst AS Recordset)
If prst Is Nothing Then
    MsgBox "nothing"
Else
    MsgBox "something"
    prst.close

End If
'Call your commondialog here
End sub
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
Je ne sais pas si je suis dur de comprennure(comme on dit en québecois mais).
How do you know which parameter to pass for prst, when you call the sub? It is impossible.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
I really have to see your code!

Which recordset are you dealing with around the place you play with the CommonDialog?
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
Éric, ce que je veux savoir; c'est seulement comment savoir quels recordsets sont encore ouverts lorsque Form1_Unload s'exécute. Cela n'a pas rapport avec un CommonDialog. Comment faire?
Je ne peux passer un recordset en paramètre, car si je passerais un recordset en paramètre, c'est parce que je le saurais quel est celui qui n'est pas fermé, et je ne le sais pas.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
As-tu un inventaire de tes recordsets?

VB ne gère pas la liste des recordsets ouverts. Donc si toi tu ne les stocks pas dans une collection ou un array ou une autre structure, tu ne pourras pas avoir la liste des recordsets ouverts!

0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
Ok, je n'ai pas d'inventaire de mes recordsets. L'idée de mettre tous les recordsets dans un tableau, comme tu dis, me semble l'idéal pour faire le test vu que Vb ne gère pas la listes des recordsets ouverts. Mets ta réponse en anglais et je l'accepterai.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 10 total points
Comment Utility
Do you any invetory of your recordsets?

VB doesn't manage a list of open recordsets. Build your list (using an array or a collection) to be able to list any open recordset at any time!
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
It semms only the way to find to find the recordsets opened.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now