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!

Access data to word 1

Status
Not open for further replies.

assets

Technical User
Oct 23, 2002
574
AU
Hi,

I am trying to populate a pulldown box on a word form for an access database table.

I am trying the followin code. But it does not populate the drop box. Any ideas would be appreciated.

Sub FDocument_close()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strPath As String
Dim doc As Document
Set dic = ThisDocument
strSQL = "SELECT LastName FROM Addresses ORDER BY LastName"
strPath = "G:\OMR\MRM\1.Management&Admin\Phone List\Phone Book Database.mdb"
Set db = OpenDatabase(strPath)
Set rst = db.OpenRecordset(strSQL)
Do While Not rst.EOF
With doc.FormFields("wfLastName").DropDown.ListEntries
.Add Name:=rst(0)
End With
rst.MoveNext
Loop
Set db = Nothing
Set rst = Nothing
End Sub



Never give up never give in.

There are no short cuts to anything worth doing :)
 
Should'nt this:
Set dic = ThisDocument
be this ?
Set d[!]o[/!]c = ThisDocument

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, Thank you a second set of eyes.
The only problem I gaving is the drop down list is limited to 25 names and that is not enough. Thes e must be a way around this. The only way I can think of is having the list split.

Thanks

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