The code bleow is in a Word Document.
Option Explicit
Private Sub ComboBox2_Change()
ActiveDocument.FormFields("Text2").Result = ComboBox2.Value
End Sub
Private Sub CmdClose_Click()
End
End Sub
Private Sub UserForm_Initialize()
Dim dbDatabase As Database
Dim rsPhone As Recordset
Dim h As Integer
Dim aResults()
Set dbDatabase = OpenDatabase("G:\OMR\MRM\_MARS\1. Management & Admin\Phone List\phone book database.mdb")
Set rsPhone = dbDatabase.OpenRecordset("addresses", dbOpenSnapshot)
h = 0
With rsPhone
Do Until .EOF
ComboBox2.AddItem (h)
ComboBox2.Column(0, h) = .Fields("Firstname") & " " & .Fields("Lastname")
.MoveNext
h = h + 1
Loop
End With
End Sub
------------------------------------------
It call the data from the first and last names in the database. it also pick up inactive users. So i need to add information for the record active
If Active=yes
so it only pick current users on the list.
This is a good work around if you need more than 25 names on the combobox.
Never give up never give in.
There are no short cuts to anything worth doing
Option Explicit
Private Sub ComboBox2_Change()
ActiveDocument.FormFields("Text2").Result = ComboBox2.Value
End Sub
Private Sub CmdClose_Click()
End
End Sub
Private Sub UserForm_Initialize()
Dim dbDatabase As Database
Dim rsPhone As Recordset
Dim h As Integer
Dim aResults()
Set dbDatabase = OpenDatabase("G:\OMR\MRM\_MARS\1. Management & Admin\Phone List\phone book database.mdb")
Set rsPhone = dbDatabase.OpenRecordset("addresses", dbOpenSnapshot)
h = 0
With rsPhone
Do Until .EOF
ComboBox2.AddItem (h)
ComboBox2.Column(0, h) = .Fields("Firstname") & " " & .Fields("Lastname")
.MoveNext
h = h + 1
Loop
End With
End Sub
------------------------------------------
It call the data from the first and last names in the database. it also pick up inactive users. So i need to add information for the record active
If Active=yes
so it only pick current users on the list.
This is a good work around if you need more than 25 names on the combobox.
Never give up never give in.
There are no short cuts to anything worth doing