Solved

Error 3045

Posted on 2000-04-14
22
216 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
ID: 2716471
Which instruction give you this error?

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

Author Comment

by:dosyl
ID: 2716491
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
ID: 2716508
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
ID: 2716541
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
ID: 2716601
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
ID: 2716662
But why is it working the first time?

0
 
LVL 1

Author Comment

by:dosyl
ID: 2716714
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
ID: 2716790
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
ID: 2716964
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
ID: 2717145
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
ID: 2717195
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:dosyl
ID: 2717235
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
ID: 2717271
«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
ID: 2717348
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
ID: 2717377

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
ID: 2717443
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
ID: 2717466
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
ID: 2717498
É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
ID: 2717526
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
ID: 2717544
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
ID: 2718127
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
ID: 2727481
It semms only the way to find to find the recordsets opened.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

17 Experts available now in Live!

Get 1:1 Help Now