exporting to word (1 Viewer)

gammatekk

Registered User.
Local time
Today, 14:20
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
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,358
What exactly are you exporting? A form?
 

gammatekk

Registered User.
Local time
Today, 14:20
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
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,358
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
Today, 17:20
Joined
May 21, 2018
Messages
8,463
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
Today, 14:20
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

  • code for export.pdf
    22.6 KB · Views: 262

gammatekk

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

gammatekk

Registered User.
Local time
Today, 14:20
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
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,358
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
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,358
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
Today, 14:20
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
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,358
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
Today, 14:20
Joined
Oct 16, 2019
Messages
10
Ok, so i changed them all to column(1) and it works??
 

gammatekk

Registered User.
Local time
Today, 14:20
Joined
Oct 16, 2019
Messages
10
Here is the code that works
 

Attachments

  • code for export2.pdf
    21.9 KB · Views: 249

Users who are viewing this thread

Top Bottom