ITHastings
asked on
Access 2013 creates Word document
I've inherited an Access application that keeps track of requests for dog licenses, liquor licenses, etc. for my city. Unfortunately, I don't have any Access experience. While the application itself is running fine, the Word documents it produces have a watermark/background that needs to be updated.
The Access application has both a front-end and a back-end. When I open them in Alt-F11 mode, I can see code, but don't see any references to where the initial Word document/template can be found.
Where do I look for it?
The Access application has both a front-end and a back-end. When I open them in Alt-F11 mode, I can see code, but don't see any references to where the initial Word document/template can be found.
Where do I look for it?
if it is a template, you should look for .dot or .dotx or .dotm
the Word documents it produces
So, it sounds like somewhere along the line, Word gets automated.
And probably as a mailmerge
Here's a snippet of how I get that started
Now, there's lots there, but the key bits are in bold
Set oApp = CreateObject(Class:="Word.Application")
Set MlMrge = oApp.ActiveDocument.MailMerge
oApp.ActiveDocument.SaveAs
For Each Thedoc In oApp.Documents
If you start looking for the bold bits in the entire VBA project, you should turn up the logic of how your app is working.
I've inherited an Access application...
Now, most developers think that storing files as attachments in tables is a lot like driving your car with your feet -- it can be done, but it's not a good idea. Your predecessor may have done so to keep the app from being broken if someone moved/renamed/deleted/edit ed the source document, so it may be in a field in a table. When you find the automation code driving Word, post it and we'll have a look.
Then the fun will begin.
So, it sounds like somewhere along the line, Word gets automated.
And probably as a mailmerge
Here's a snippet of how I get that started
'open the mergedoc
Dim oApp As Object
Dim MlMrge As Object
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'this will open a new document based on the path as a template. Excellent
'but it doesn't open it as a mail merge
oApp.Documents.Add "c:\temp\Field Repair Welding Procedure Merge.doc"
Set MlMrge = oApp.ActiveDocument.MailMerge
With MlMrge
'do the merge
.OpenDataSource Name:="C:\temp\tblWeldProcData.xls", Connection:="DSN=Excel Files;DBQ=C:\temp\tblWeldProcData.xls;DriverId=1046;MaxBufferSize=2048;PageTimeout=5;", SQLStatement:="SELECT * FROM `tblWeldProcData`", SubType:=0 'wdMergeSubTypeOther
.ViewMailMergeFieldCodes = 9999998 'wdToggle
.Destination = 0 'wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = 1 'wdDefaultFirstRecord
.LastRecord = -16 'wdDefaultLastRecord
End With
.Execute (False)
End With
'save the merged doc
oApp.ActiveDocument.SaveAs "c:\temp\RPR.doc"
Dim Thedoc As Object
'close the mergedoc
For Each Thedoc In oApp.Documents
If Thedoc.Name Like "document*" Then
oApp.Documents(Thedoc.Name).Close False
End If
Next Thedoc
oApp.Visible = True
Now, there's lots there, but the key bits are in bold
Set oApp = CreateObject(Class:="Word.Application")
Set MlMrge = oApp.ActiveDocument.MailMerge
oApp.ActiveDocument.SaveAs
For Each Thedoc In oApp.Documents
If you start looking for the bold bits in the entire VBA project, you should turn up the logic of how your app is working.
I've inherited an Access application...
Now, most developers think that storing files as attachments in tables is a lot like driving your car with your feet -- it can be done, but it's not a good idea. Your predecessor may have done so to keep the app from being broken if someone moved/renamed/deleted/edit
Then the fun will begin.
ASKER
The backend only has tables, there's no code. When I do a search on the front-end, I don't see any .doc* files. I bring up the find tool, have it look for ".doc*" and search in "Current Project", it doesn't find anything.
What else can I look for, or where else should I be looking?
What else can I look for, or where else should I be looking?
ASKER
There's lots of occurrences of code (based on license type) like this, but I don't know enough about Access to know what I'm missing.
Private Sub cmdPrintReceipt_Click()
On Error GoTo Err_cmdPrintReceipt_Click
Dim stDocName As String
stDocName = "rptDogLicenseReceipt"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPrintReceipt_Click:
Exit Sub
Err_cmdPrintReceipt_Click:
MsgBox Err.Description
Resume Exit_cmdPrintReceipt_Click
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
to Rey Obrero: Yes, I did a search through the code for all of the bolded strings, but found nothing.
ASKER
to Nick67: Previewed the document and had a choice for Design View. Thanks for your help.
@ITHastings.
That's pretty terse!
So, you are dealing with a report
Were you able to get the changes you needed accomplished?
That's pretty terse!
So, you are dealing with a report
Were you able to get the changes you needed accomplished?
ASKER
Thanks for your patience.
Glad to be of assistance!
The code may be part of a form.
If you don't find it there, then the template used may be a value stored in a table as a field. Look through the table names for anything like "Settings", "init", etc.
Jim.