Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-09-2012, 12:44 PM   #1
alex_117058
Newly Registered User
 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alex_117058 is on a distinguished road
Question Formatting problem when exporting from Access 2007 to word doc

Hello everyone,
I'm very new to access and computer programming in general, but thanks to sites such as this, I've learned quite a bit. I'm managing a database for a client and for the most part it does exactly what I want it to do. The only issue is that when I export a report in access 2007 to word, I get repeating labels in the word document. I have the "hide duplicates" function on in the report, so the only labels that I see on the report are unique. Therefore, I should not be seeing duplicates in the doc. An example is this:

Access 2007 report
Ch1
Part 1
Part 2
Part 3

Ch2
Part 4
Part 5
Part 6

Ch3
Part 7
Part 8
Part 9

etc.

However, in Word:
Ch1
Part 1
Part 2
Part 3

Ch2
Part 4
Part 5
Part 6

Ch2
Part 7
Part 8
Part 9
etc.

Everything is correct about the report except the underlined header being repeated for every category (each category is different from each other). Right now, I'm thinking it's a word program glitch? I've tried to export in pdf and all the underlined headers come out correct. Unfortunately, I need the report to be exported into word for further manipulation. Thanks for any help!

Also, as a follow up to the post, I'm currently using a macro to export from access to word. I'm aware of the export function in the external data tab on the ribbon, but the client likes to have things as simple and automated as possible, so a button on the report would be much more preferable than having to run an a saved export function each time. Thanks again.


Last edited by alex_117058; 01-09-2012 at 01:11 PM. Reason: more information
alex_117058 is offline   Reply With Quote
Old 01-10-2012, 02:32 AM   #2
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Formatting problem when exporting from Access 2007 to word doc

If it's exporting correctly to PDF and it displays correctly, then it could be a coding issue or a problem with Word. Do you have code that sets the value of the underlined category?

What happens if you export to Excel?
vbaInet is offline   Reply With Quote
Old 01-10-2012, 06:35 AM   #3
alex_117058
Newly Registered User
 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alex_117058 is on a distinguished road
Re: Formatting problem when exporting from Access 2007 to word doc

I have the value of the underlined category coming directly from a form. The whole report is generated from a single form. I've exported it into the .rtf, .txt, and excel formats and I've gotten the same issue as before. Another thing is that since I've been using Access, there are times when the macros I create act "weird", as in i'll have two macros in the same form. One will open a report associated with the form and the other will open a different form. However, I'll try to test it after closing all relevant forms and both macros will open the same report or the same form. I've found that when I use vba these issues don't happen. Do you think this could be another instance where vba would be better? Thanks! -- Alex

alex_117058 is offline   Reply With Quote
Old 01-10-2012, 07:16 AM   #4
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Formatting problem when exporting from Access 2007 to word doc

Macros aren't that bad really. It's just how you write the sequences and the actions that follow. I prefer VBA anyway.

Can you convert the macro to VBA and post it here.

Also, what's in the Control Source of that textbox on the form?
vbaInet is offline   Reply With Quote
Old 01-10-2012, 09:27 AM   #5
alex_117058
Newly Registered User
 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alex_117058 is on a distinguished road
Re: Formatting problem when exporting from Access 2007 to word doc

Haha, I guess I have bad luck then. Most of the macros I'm using are just one action macros. Namely the "outputto" function. As for using vba, I'm not entirely sure how to write the code needed to export from report to word. Also, it turns out that the report is actually getting all the information from a query. Thanks again.
alex_117058 is offline   Reply With Quote
Old 01-10-2012, 09:30 AM   #6
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Formatting problem when exporting from Access 2007 to word doc

Open the query in design view and look around, you should find a menu or button that will allow you to convert a macro to VBA code. Post that.

What I meant is, a textbox has a Control Source property which is basically the text you see in the textbox when the form is in design view. What's written in those textboxes when the form is in design view?
vbaInet is offline   Reply With Quote
Old 01-11-2012, 07:39 AM   #7
alex_117058
Newly Registered User
 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alex_117058 is on a distinguished road
Re: Formatting problem when exporting from Access 2007 to word doc

The vba code for the macro:
Private Sub Command34_Click()
On Error GoTo Command34_Click_Err

DoCmd.OutputTo acOutputReport, "BookChapters", "RichTextFormat(*.rtf)", "", True, "", 0, acExportQualityPrint

Command34_Click_Exit:
Exit Sub
Command34_Click_Err:
MsgBox Error$
Resume Command34_Click_Exit
End Sub

As for the control source, it says "ChapterNumber" when I view it in design view.

Thanks again!

alex_117058 is offline   Reply With Quote
Old 01-11-2012, 08:07 AM   #8
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Formatting problem when exporting from Access 2007 to word doc

I don't see anything wrong with it. What if you take out the 0?
vbaInet is offline   Reply With Quote
Old 01-11-2012, 08:34 AM   #9
alex_117058
Newly Registered User
 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alex_117058 is on a distinguished road
Re: Formatting problem when exporting from Access 2007 to word doc

Same issue. I might have to tell my client to do a manual export instead of using a macro. It appears that word is having a programming issue? I'm not sure what to do about that other then to not use macros for specific reports now..
alex_117058 is offline   Reply With Quote
Old 01-11-2012, 08:39 AM   #10
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Formatting problem when exporting from Access 2007 to word doc

Can you upload the table and report you're having problems with? I don't need sensitive data.
vbaInet is offline   Reply With Quote
Reply

Tags
access 2007 , export access to word , word

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Access 2007 Report to Word 2007 mike012321 Reports 5 08-16-2012 07:50 AM
Question Need help with text formatting or exporting to Word (retain formatting necessary)! hmoritz72 General 2 05-05-2010 08:00 PM
Exporting Access 2007 report to Word with Runtime version Henley12 Reports 4 01-05-2010 10:08 AM
Exporting Data to Word and Formatting Tables Starman Modules & VBA 0 10-15-2008 10:42 AM
Problem when exporting data from access to word document with bookmarks Alex123 Modules & VBA 5 03-04-2008 03:16 AM




All times are GMT -8. The time now is 12:05 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World