Error 3045

I have this error at the end of my pgm.. Is there a way to find which recordset is opened again?
LVL 1
dosylAsked:
Who is Participating?
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
Which instruction give you this error?

Is the message looks like "File in use"?
0
 
dosylAuthor Commented:
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
dosylAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
dosylAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
But why is it working the first time?

0
 
dosylAuthor Commented:
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
 
dosylAuthor Commented:
For answering to my question; is there a way to find the opened recordset instead to do steps by steps(F8)?
0
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
dosylAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
dosylAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
«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
 
dosylAuthor Commented:
I'd need an example, i cannot see how you check it. Code please,maybe. It is only to know for another time.
0
 
Éric MoreauSenior .Net ConsultantCommented:

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
 
dosylAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
I really have to see your code!

Which recordset are you dealing with around the place you play with the CommonDialog?
0
 
dosylAuthor Commented:
É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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
dosylAuthor Commented:
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
 
dosylAuthor Commented:
It semms only the way to find to find the recordsets opened.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.