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
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