Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bound field problem

Status
Not open for further replies.

Steven811

Technical User
Apr 15, 2004
76
GB
Hi

I've created code (using examples from the forums) to export data from an active form/subforms to Word, this all works okay.

One of the controls is a combo box displaying a linked field from a select query.

My problem is that the code prints correctly the contents of the bound field
[contactID] and I want it to print the contents of the linked field [contact name] and I can't remember how to do it.

I'd be grateful for a pointer.

Steven811

The code to export the bound field is as follows:

[.ActiveDocument.Bookmarks("cboManager").Select
.Selection.Text = (CStr(Me!subForm1.Form!subForm2.Form!cboManager))]
 
I think you need the text property of the combo box.

Try:

Code:
.ActiveDocument.Bookmarks("cboManager").Select
.Selection.Text = (CStr(Me!subForm1.Form!subForm2.Form!cboManager[b].text[/b]))


Bob Stubbs
 
Hi Bob

Thanks for the reply

Nope! Doesn't work.

This is so frustrating, I have done this successfully in the past and I'm more annoyed with myself than anything for forgetting.

Rgds

Steven811
 
To be clear, does your combo field have 2 columns sized 0";1" or similar? If yes, you may get the text value buy

me.destinationfield = me.combofield.column(1)

Hope this works out for you. Let me know if you need more.

I haven't failed, I have just found 10,000 ways that it won't work!
 
Hi

The combo fields have coloumns exactly as you describe
2 columns, 1st is bound. The widths set so that the 1st column is hidden. It is the 2nd column (correct text shown on the form)on that I wish to export.

I am unsure how to modify my code to include your suggestion.

Rgds

Steven811
 
Try combining my suggestion with that from txaccess.

Write:
Code:
[.ActiveDocument.Bookmarks("cboManager").Select
.Selection.Text = (CStr(Me!subForm1.Form!subForm2.Form!cboManager.column(1)))]

Bob Stubbs
 
How about...

[.ActiveDocument.Bookmarks("cboManager").Select
.Selection.Text = (CStr(Me!subForm1.Form!subForm2.Form!cboManager.Column(1)))]

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top