Error in form Load

G

Guest

I receive an error when opening my startup form.
Couldn't use"; file already in use


This code connects to a front end Access database, that is linked to a back
end.
Private Sub Form_Load()
Dim dbconn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmdCommand As ADODB.Command
Dim strSQL As String


Set dbconn = New ADODB.Connection
With dbconn
.Provider = "Microsoft.Jet.OLEDB.4.0 "
.Open "C:\Documents and Settings\user\My Documents\Inventory
Reporting.mdb"

End With

I have some code that needs to run after I open the application, but it
does'nt get past .Open "C:\Documents and Settings\user\My Documents\Inventory
Reporting.mdb"
 
M

Matthias Klaey

JoeA2006 said:
I receive an error when opening my startup form.
Couldn't use"; file already in use


This code connects to a front end Access database, that is linked to a back
end.
Private Sub Form_Load()
Dim dbconn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmdCommand As ADODB.Command
Dim strSQL As String


Set dbconn = New ADODB.Connection
With dbconn
.Provider = "Microsoft.Jet.OLEDB.4.0 "
.Open "C:\Documents and Settings\user\My Documents\Inventory
Reporting.mdb"

End With

I have some code that needs to run after I open the application, but it
does'nt get past .Open "C:\Documents and Settings\user\My Documents\Inventory
Reporting.mdb"

Move all of the code from the Form_Load event to the Form_Open event
and try again.
I am not really sure if this helps, but this is what I would try
first.

Kind regards
Matthias Kläy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top