exporting to word (1 Viewer)

gammatekk

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
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

I’m here to help
Local time
Yesterday, 16:42
Joined
Oct 29, 2018
Messages
10,810
What exactly are you exporting? A form?
 

gammatekk

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
fields from a form, that go into a word document for printing out.
 

theDBguy

I’m here to help
Local time
Yesterday, 16:42
Joined
Oct 29, 2018
Messages
10,810
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

You've got your good things, and you've got mine.
Local time
Yesterday, 19:42
Joined
May 21, 2018
Messages
3,196
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

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
sorry, so new to this, let me me see if this works.

But I think MajP might be on to something
 

Attachments

gammatekk

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
my word document has bookmarks that correspond to the fields
 

gammatekk

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
Also, I have to have word already open for this to work. Word does not open, as i thought the code would do.
 

theDBguy

I’m here to help
Local time
Yesterday, 16:42
Joined
Oct 29, 2018
Messages
10,810
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...
 

theDBguy

I’m here to help
Local time
Yesterday, 16:42
Joined
Oct 29, 2018
Messages
10,810
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

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
unfortunately my word fields are now empty after adding ".Column(x)"
checked correct column and correct spelling etc.
 

theDBguy

I’m here to help
Local time
Yesterday, 16:42
Joined
Oct 29, 2018
Messages
10,810
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

Registered User.
Local time
Yesterday, 16:42
Joined
Oct 16, 2019
Messages
10
Ok, so i changed them all to column(1) and it works??
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom