Access World Forums

Access World Forums (https://www.access-programmers.co.uk/forums/index.php)
-   Word (https://www.access-programmers.co.uk/forums/forumdisplay.php?f=54)
-   -   exporting to word (https://www.access-programmers.co.uk/forums/showthread.php?t=307427)

gammatekk 10-18-2019 08:05 AM

exporting to word
 
Help,
exporting to a word document and any field that is a combo box shows up as the field # instead of the text.
How can I correct this?

Gammatekk

theDBguy 10-18-2019 08:10 AM

Re: exporting to word
 
What exactly are you exporting? A form?

gammatekk 10-18-2019 08:18 AM

Re: exporting to word
 
fields from a form, that go into a word document for printing out.

theDBguy 10-18-2019 08:19 AM

Re: exporting to word
 
Quote:

Originally Posted by gammatekk (Post 1645434)
fields from a form, that go into a word document for printing out.

Not sure I'm clear yet. Can you show us the code you're using for the export? If you're doing it manually using the Ribbon, could you describe the steps you take? Thanks!

MajP 10-18-2019 09:47 AM

Re: exporting to word
 
I have not tested that, but I think that is the normal behavior. If you have a combobox and the bound field is the primarykey (numeric), but the combo is showing the related text then when you export you get the bound value. The easy solution is to turn it into a textbox and include the text in the query.

gammatekk 10-18-2019 10:13 AM

Re: exporting to word
 
1 Attachment(s)
sorry, so new to this, let me me see if this works.

But I think MajP might be on to something

gammatekk 10-18-2019 10:14 AM

Re: exporting to word
 
my word document has bookmarks that correspond to the fields

gammatekk 10-18-2019 10:15 AM

Re: exporting to word
 
Also, I have to have word already open for this to work. Word does not open, as i thought the code would do.

theDBguy 10-18-2019 10:40 AM

Re: exporting to word
 
Quote:

Originally Posted by gammatekk (Post 1645467)
sorry, so new to this, let me me see if this works.

But I think MajP might be on to something

Hi. Thanks for posting the code. For the combobox controls, you can use the Column property to grab the displayed value instead of the bound value. For example:
Code:

.FormFields("DropDown1").Result = Me.PET_TX.Column(1)
Hope that helps...

gammatekk 10-18-2019 10:48 AM

Re: exporting to word
 
ok, let me give it a try

theDBguy 10-18-2019 10:50 AM

Re: exporting to word
 
Quote:

Originally Posted by gammatekk (Post 1645479)
ok, let me give it a try

Hi. Since I was just guessing which one is a combobox, please make sure you pick the right one and use its name, okay? Also, just FYI, Column index is zero (0) based. So, if you want the 3rd column, use 2. Cheers!

gammatekk 10-18-2019 01:15 PM

Re: exporting to word
 
unfortunately my word fields are now empty after adding ".Column(x)"
checked correct column and correct spelling etc.

theDBguy 10-18-2019 01:42 PM

Re: exporting to word
 
Quote:

Originally Posted by gammatekk (Post 1645515)
unfortunately my word fields are now empty after adding ".Column(x)"
checked correct column and correct spelling etc.

Can you show us an example of how you implemented it? Thanks!

gammatekk 10-18-2019 02:20 PM

Re: exporting to word
 
Ok, so i changed them all to column(1) and it works??

gammatekk 10-18-2019 03:15 PM

Re: exporting to word
 
1 Attachment(s)
Here is the code that works


All times are GMT -8. The time now is 04:15 PM.

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