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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Problem 1

Status
Not open for further replies.

assets

Technical User
Oct 23, 2002
574
AU
Hi from the code below you will see I sending data to word.

The FirstName works fine, data stored in the main table (as text) (table addresses) the problem is the division. It only display the division number and not the name.

DivisionID is a number field in address. In table division there is divisionID number and division (the name). The data is displayed in table adresses because of:

SELECT Division.DivisionID, Division.Division, FROM Division;

But in the word document only the correct number. How do I get it to display names.
Do I need a lookup, or set the dataset?



Code:
.ActiveDocument.Bookmarks("FirstName").Select
.Selection.Text = CStr(Me.FirstName.Value)
.ActiveDocument.Bookmarks.Add Name = FirstName

.ActiveDocument.Bookmarks("cost").Select
.Selection.Text = CStr(Me.DivisionID.Value)

Never give up never give in.

There are no short cuts to anything worth doing :)
 
What about this ?
.Selection.Text = Nz(DLookUp("Division", "Division", "DivisionID=" & Me!DivisionID), "?")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
THANK YOU very much.

If I also want to ad Costcentre next to division ( from the table division what do I need to add to the code.

Again thank you for you advice

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top