Copying an Object within a database

C

Chase

I am using Access 2003 running as 2000. My PC OS is Win XP Pro on a Windows
2003 network.
The following is two versions of the VBA code, to copy an object with the
database and then save it out to a serve, that I have on a Form, the first is
on the local PC "C:\" drive and works the second is on a network drive and
generates the following error:-
"Error No: 3734; Description: The database has been plased in a stste by
'Admin' on machine 'WS-XP-018' that prevents it from being opened or locked."

First Version that works

Private Sub cmdExpSum_Click()
On Error GoTo ErrorHandler
Dim StrPath As String
Dim StrRegion As String

StrPath = "\\Admiral-srv1\data\VolumeDatabase\Reports\" & txtFileName &
".xls"
StrRegion = ("qctb" & Forms![frmReportOps]![cboRegion])
DoCmd.SetWarnings False
Me.Form.Requery
DoCmd.CopyObject "C:\VolumeDatabase\ProcessReport.mdb", StrRegion,
acQuery, "qctbSummary"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrRegion,
StrPath, True
DoCmd.DeleteObject acQuery, StrRegion
DoCmd.SetWarnings True

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

Second Version that does not work and generates the error when the
DoCmd.CopyObject routine is run.

Private Sub cmdExpSum_Click()
On Error GoTo ErrorHandler
Dim StrPath As String
Dim StrRegion As String

StrPath = "\\admiral-srv1\data\VolumeDatabase\Reports\" & txtFileName &
".xls"
StrRegion = ("qctb" & Forms![frmReportOps]![cboRegion])
DoCmd.SetWarnings False
Me.Form.Requery
DoCmd.CopyObject
"\\admiral-srv1\data\VolumeDatabase\ProcessReport.mdb", StrRegion, acQuery,
"qctbSummary"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrRegion,
StrPath, True
DoCmd.DeleteObject acQuery, StrRegion
DoCmd.SetWarnings True

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

PLEASE HELP
 
6

'69 Camaro

Hi, Chase.
"Error No: 3734; Description: The database has been plased in a stste by
'Admin' on machine 'WS-XP-018' that prevents it from being opened or locked."

The user on computer WS-XP-018 has the database application open in
exclusive mode. Until this user either exits the database or completes the
modification of the database that has temporarily elevated it to exclusive
mode (if this user opened it in shared mode), then you will not be able to
import the query.

Most likely, the user on computer WS-XP-018 is editing a form, report, or
module in the database on the server. If this is not an Access developer in
your organization, then this is probably "not a good thing," and you'll want
to investigate who is fiddling with your masterpiece.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Chase said:
I am using Access 2003 running as 2000. My PC OS is Win XP Pro on a Windows
2003 network.
The following is two versions of the VBA code, to copy an object with the
database and then save it out to a serve, that I have on a Form, the first is
on the local PC "C:\" drive and works the second is on a network drive and
generates the following error:-
"Error No: 3734; Description: The database has been plased in a stste by
'Admin' on machine 'WS-XP-018' that prevents it from being opened or locked."

First Version that works

Private Sub cmdExpSum_Click()
On Error GoTo ErrorHandler
Dim StrPath As String
Dim StrRegion As String

StrPath = "\\Admiral-srv1\data\VolumeDatabase\Reports\" & txtFileName &
".xls"
StrRegion = ("qctb" & Forms![frmReportOps]![cboRegion])
DoCmd.SetWarnings False
Me.Form.Requery
DoCmd.CopyObject "C:\VolumeDatabase\ProcessReport.mdb", StrRegion,
acQuery, "qctbSummary"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrRegion,
StrPath, True
DoCmd.DeleteObject acQuery, StrRegion
DoCmd.SetWarnings True

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

Second Version that does not work and generates the error when the
DoCmd.CopyObject routine is run.

Private Sub cmdExpSum_Click()
On Error GoTo ErrorHandler
Dim StrPath As String
Dim StrRegion As String

StrPath = "\\admiral-srv1\data\VolumeDatabase\Reports\" & txtFileName &
".xls"
StrRegion = ("qctb" & Forms![frmReportOps]![cboRegion])
DoCmd.SetWarnings False
Me.Form.Requery
DoCmd.CopyObject
"\\admiral-srv1\data\VolumeDatabase\ProcessReport.mdb", StrRegion, acQuery,
"qctbSummary"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrRegion,
StrPath, True
DoCmd.DeleteObject acQuery, StrRegion
DoCmd.SetWarnings True

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

PLEASE HELP
 

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