A
AccessARS
I have the following module in my database which merges data from a temporary
table (temp_PIC) in the same database into a pre-designed Word merge document
template located on our server...
Function MergeIt()
Dim objWord As Word.Document
Set objWord =
GetObject("\\holnt01\public\Projects-Hollywood\CustomerCareAdministrative\Attendance\Write-ups\PIC Output\PicMerge1.doc", "Word.Document")
' Make Word visible.c
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource _
Name:="\\holnt01\public\Projects-Hollywood\S3\Databases\Working\Attendance\Attendance.mdb", _
LinkToSource:=True, _
Connection:="TABLE temp_PIC", _
SQLStatement:="SELECT * FROM [temp_PIC]"
' Execute the mail merge.
objWord.MailMerge.Execute
objWord.Close
End Function
....The original Word merge document template is already linked to the temp
table therefore in the process when it opens the original prior to making the
copy it prompts …
Opening this document will run the following SQL command:
SELECT * FROM[temp_PIC]
Data from your database will be placed in the document. Do you want to
continue?
YES/NO
....When I click YES or NO it gives me the following error message…
ODBC Microsoft Access Driver Login Failed
The database has been placed in a state by user 'Admin' on machine 'SCHOLD-
WKF-8014' that prevents it from being opened or locked.
....'SCHOLD-WKF-8014' is my computer.
What can I do when it’s obviously going to be open when the code is running?
table (temp_PIC) in the same database into a pre-designed Word merge document
template located on our server...
Function MergeIt()
Dim objWord As Word.Document
Set objWord =
GetObject("\\holnt01\public\Projects-Hollywood\CustomerCareAdministrative\Attendance\Write-ups\PIC Output\PicMerge1.doc", "Word.Document")
' Make Word visible.c
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource _
Name:="\\holnt01\public\Projects-Hollywood\S3\Databases\Working\Attendance\Attendance.mdb", _
LinkToSource:=True, _
Connection:="TABLE temp_PIC", _
SQLStatement:="SELECT * FROM [temp_PIC]"
' Execute the mail merge.
objWord.MailMerge.Execute
objWord.Close
End Function
....The original Word merge document template is already linked to the temp
table therefore in the process when it opens the original prior to making the
copy it prompts …
Opening this document will run the following SQL command:
SELECT * FROM[temp_PIC]
Data from your database will be placed in the document. Do you want to
continue?
YES/NO
....When I click YES or NO it gives me the following error message…
ODBC Microsoft Access Driver Login Failed
The database has been placed in a state by user 'Admin' on machine 'SCHOLD-
WKF-8014' that prevents it from being opened or locked.
....'SCHOLD-WKF-8014' is my computer.
What can I do when it’s obviously going to be open when the code is running?