Recall - Export To MS Word
Nov 17, 2004
I have a template fax set up in Microsoft word and want to be able to export fields from my database (in form view) to the word document. For example, I have a 'purchase order No' on the access form which I want to send to the Word document. When exported I then want the user to be prompted to save the document as a new name so they do not overwrite the original template fax.
Any ideas guys,
Cheers,
Recall.
View Replies
ADVERTISEMENT
Jun 26, 2006
Boy am I frustrated.
I have searched the forums for similar problem but I was unable to find it.
I have some buttons that export the data from a form into a Word Document. It generally works but there are some issues.
I have Access 2003 but the people using it only use the runtime version of Access and the environment is Office 2000.
I have copied code from other examples and maybe missing something that is causing the issues.
1. When I export the record it is causing problems with the Normal.dot template. When I try to close Word it keeps asking me that I have modified that template. After pressing Cancel button twice it the save box disappears.
2. When I leave the code Dim objWord As word.Application I get an error message about a compile error User defined Type not defined.
2. When the users try to export a record to the specific word template I
created and a required field is empty an error message is displayed and then closes the application.
Any help will be appreciated. I am a newbie when it comes to code.
Sample code is below.
Private Sub Command1079_Click()
Dim objWord As word.Application
'Start Microsoft Word 2000.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = False
'path and name of the template your are using.
' objWord.Documents.Add ("U:Asset Strategy and Commercial PropertyCommercial PropertyTaskmasterletterofobjection.dot")
.Documents.Open ("C:Documents and SettingsDadMy DocumentsWorkTaskmasterletterofobjection.dot")
'This is for the bookmark that you created in the template
.ActiveDocument.Bookmarks("bmSubject").Select
Selection.Text = Forms![frmTaskMaster_LeaseManagement]![Subject]
.ActiveDocument.Bookmarks("bmCurrentRent").Select
.Selection.Text = Format(CCur(Forms![frmTaskMaster_LeaseManagement]![CurrentRent]), "Currency")
.ActiveDocument.Bookmarks("bmVendetails").Select
.Selection.Text = Forms![frmTaskMaster_LeaseManagement]![VenDetails]
.ActiveDocument.Bookmarks("bmDateNotice").Select
.Selection.Text = Format(CDate(Forms![frmTaskMaster_LeaseManagement]![RentNotice]), "dd mmmm yyyy")
.ActiveDocument.Bookmarks("bmRentReviewDate").Select
.Selection.Text = Format(CDate(Forms![frmTaskMaster_LeaseManagement]![ReviewDate]), "dd mmmm yyyy")
.ActiveDocument.Bookmarks("bmAskingRent").Select
.Selection.Text = Format(CCur(Forms![frmTaskMaster_LeaseManagement]![AskingRent]), "Currency")
End With
Print_Reconsideration_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
.Selection.Text = ""
Resume Next
End If
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Sub
View 3 Replies
View Related
Mar 20, 2008
I have a table called "MPI_CODE" it has 4 columns. How can I export this to Word? By creating a new document first (Using Save dialog) then exporting that table to the word doc. Mainly looking for the code to export the table into word.
Thanks in advance for your help.
View 2 Replies
View Related
Mar 7, 2006
Hello friends, I have a good question for you.
I have a form in Access with a check box named chk1.
On the same form I have a code that export my data to a template in MS Word. I use bookmark to export my access data. No problem with regular data but cannot handle checkboxes. Basically I need help to export the check box value (yes or no) into a check box places in my word template. In this template I have a checkbox. If I doulble click in to it I get a window which allows me to bookmark the checkbox but when I export the access data, I will get a YES or NO priot to the checkbox in word. Is there any way I can solve this problem?
This is a sample of my code:
objWord.ActiveDocument.Bookmarks("chek1").Select
If Err.Number = 0 Then
objWord.Selection.Text = Me.chek1
Else
Err.Number = 0
End If
Is the probkem in the Selection.text?
Thank you.
View 1 Replies
View Related
Apr 12, 2006
Friend, I am using a code to export data from a table to a word document using bookmarks and have a problem with the SSN format.
When I export the ssn it shows in my word field in this way:
123456789. What I need it that it shows using the following format: 123-45-6789
This is the code:
objWord.ActiveDocument.Bookmarks("SSN").Select
If Err.Number = 0 Then
objWord.Selection.Text = Me.SSN
Else
Err.Number = 0
End If
Any help?
View 5 Replies
View Related
Sep 26, 2013
I'm trying to create an export to word but am having some trouble. I keep getting the following error;
Run time error '91'; variable or object of With block not defined.
This error occurs at Set TblWord = docNew.Tables.Add(Selection.Range, 3, 5)
I have a feeling its 'Selection' that is causing the problem but I can't work it out!
Code:
Dim AppWord As Word.Application
Dim DocWord As Word.Document
Dim TblWord As Word.Table
[Code]......
View 4 Replies
View Related
Jan 16, 2006
we run a family business and i do all the quotations.
i have an access database in which i record these quotations and whether or not we got the job or not, and i have to input all the data manually.
i wondered if i could set a word document so that it would automatically export certain areas of the quotation (like the date, who it was to, what work we are quoting for, how much it would cost, etc) into the correct fields in my database.
can it be done??
any replies will be much appreciated.
thanks
View 5 Replies
View Related
Jul 17, 2015
i have a form which displays 2 charts, i am able to export them to word document but i donot know how to paste them one after the other. currently they get printed one over the other.
here is the code :
Code:
Private Sub cmd_Print_Click()
Dim MyChartObj As Object
Dim MyLineObj As Object
Set MyChartObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Chart]
Set MyLineObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Line]
MyChartObj.SetFocus
DoCmd.RunCommand acCmdCopy
[Code]...
View 1 Replies
View Related
Feb 27, 2014
Is there a way to export a report from Access into Word so that it keeps all its formatting etc. The only option shown is in RTF format.
View 2 Replies
View Related
Oct 10, 2014
I have a database witch includes a continuous form (named frmExport). It could be very useful for me if i can find a way so to export data from access 2007 and then to import them into a word file.
Please note: The access data will be inserted into word table.
View 2 Replies
View Related
Jan 11, 2014
I want to insert access report in a word document, for this, I use this code:
DoCmd.OutputTo acReport, "rptName", acFormatRTF, "C:ReportFileName.rtf"
But, when that output word file is empty, don't have any chart that was in access report.
View 6 Replies
View Related
Aug 3, 2005
I had to delete a database so I exported selected records using export as a text file thinking I would get some sort of delimited text file that I could later use. Instead I got some sort of fixed length file with .............. between records and | between fields.
I'd like to convert this data to a tab delimited file.
How would I do this?
Thanks
View 12 Replies
View Related
Jun 17, 2013
Is there a way to export a query of 14 items to a word report. I have a table of 14 items in that I use as a query but it only exports 1 item to the report.
View 2 Replies
View Related
Dec 17, 2013
I am trying to export an attachment item (Picture .jpg) to a word document. I have been exporting text to a word document successfully with below syntax "
With rst
strLandSalesID = Nz(.Fields("LandSalesID"))
strPhotograph = Nz(.Fields("Attachments"))
However, attachment do not work.
View 3 Replies
View Related
Jul 10, 2014
How do I export report or table to word document with check box so people can check them and send to me back. I can change my records.
For example
Delete ITEM
5540 (Chick box goes here, they can tick)
View 5 Replies
View Related
Apr 14, 2013
I would like to have a button (cmdPrintIntroLetter) on my Client Details form that takes the client name, address and company data of the record that I'm currently viewing and putting it into an address box in a Word document.
e.g. when I contact a new customer and input their details into my form I want to then be able to send them an introductory letter (standard wording) from me with just the click of a button.
FAO: FirstName LastName
CompanyName
Address1
Address2
Address3
Town
County
Postcode
I've been faffing around with concatenating my address fields into an address textbox in a report but I really don't like using a report to write a letter, it just feels wrong - on every level.I also want another button (cmdEmailBrochure) which opens an email template using the records email address and inserting the name of the client into the body of the email.
View 1 Replies
View Related
May 25, 2015
I am working in Access 2013.I'll be performing a series of inspections at a number of intersections for a small community. The data being captured is consistent from site to site and lends itself to a database application, and what I would like to do is the following:Use forms to capture the data.Generate a report to preview the output for a single record. I may ultimately decide to set the report datasource to a query.Attach a macro to a button that exports fields from that record to a template based in MS Word.The first two bullet items I can handle with my limited Access capability. Each file has to be individually reviewed and saved, and each file will ultimately contain an electronic signature.
View 2 Replies
View Related
Apr 10, 2014
Like the title says it:
Is it possible to link/export a query to a existing Word document?
I have several Word documents with text, and i want to place the data of a few query's in those documents in a certain place.
Is this possible true vba or another way?
View 4 Replies
View Related
Aug 4, 2014
Is there a quick way to export ALL VBA code to a text file/word document?
View 5 Replies
View Related
Apr 11, 2013
How to match 4 character word or number or combination by identical 4 characters word or number or combination in one word have 10 or 15 characters.
I have to two separate tables (Table A and Table B). Table A has one column (Tag No) and Table B has about 15 columns with one column name Tag No as below
Table A
Table B
Tag No
Tag No
2009
ZZZ-2030-DC
2010
ZZZ-2010-M9P
[code]....
They're both in MS Access.I am trying to match 2 tables - columns (Tag No) with join query, but not success. I want to match 4 characters in Table-A with 4 similar characters in Table-B (Tag No) cell.What query is suitable to compare two tables.
View 8 Replies
View Related
Aug 14, 2014
My end goal is to populate a pre-existing table in an MS Word document with records from a query. The easiest way I've found (through scouring the internet) is to start with the code below (ran during OnClick() even in Access) to get the table the same size as the recordset:
Code:
Dim wDoc As Word.Document
Dim wTable As Word.Table
Dim wCell As Word.Cell
Set wDoc = appWord.Documents.Add(strDocLoc)
wDoc.Visible = True
[Code] ....
The code will shrink the table down just fine if the table has more rows than the recordset +1 (for header column). My hangup with this is the last line ("Selection.InsertRowsBelow 5") isn't executing; rows are not being added to the table. I get no errors -- it just does nothing. I set it as "Selection.InsertRowsBelow 5" arbitrarily just to see if it would even add rows, and sure enough it's not.
View 9 Replies
View Related
Nov 17, 2004
I want to add a system of getting unique numbers into my database based on the month followed by a unique 3 digit code. For example, if it is February and this is the first record then the reference will read 02/001. Any ideas how I would go about doing this.
I've set up a seperate table called Reference numbers as these reference numbers will be used on any number of forms.
Cheers,
Recall.
View 1 Replies
View Related
Feb 9, 2005
I've set up a DB to monitor employee hours. I have an employee table with a relationship to work done (one record = one days of work), so everyday is a new record in the work table. This is fine to monitor daily work patterns. However I need to calculate weekly work and other calculations (such as sixth and seventh shift payments, 15%payments, 25% payments etc). Is there any way that I can create a query that will give me one record for an employee that gives me start and end time for a Sunday, same for a Monday etc.
In other words I want to put start and end time for a Sunday to Saturday ( 7 records) into 1 record at the end of the week? (for each employee in the DB.
Any ideas?
Recall.
View 1 Replies
View Related
Nov 9, 2004
How can I specify the list that appears in a combo box by programming it with VBA.
I have eight unbound text boxes on a form and I want a combobox to generate its drop down based on the values in these boxes.
I think I'd have to create 8 variables and take the values from these text boxes and assign to the variables. The bit I get stuck on is how to make these variables appear in the combo box list.
Please help,
Recall
View 1 Replies
View Related
Nov 20, 2004
I do not want the cursor to move to the next control on a form when the user presses the enter key. It is a memo field and I want the cursor to move to the next line as it would in a word document.
Any ideas,
Recall
View 1 Replies
View Related
Nov 23, 2004
This is probably v. simple but is doin me head in.
I've got a form based on a query containing three figures (currency). I want a total box that will add the 3 up. On the query I've created a field called Total with the following:
Total:sum([Text1]+[Text2]+Text3])
When three figures are in it works fine. If one of the figures is not there it displays #Name. I could get the fields in the table to automatically display 0, but if a user deletes off the 0 I'm stuffed.
Where am I going wrong?
Recall.
View 1 Replies
View Related