Dwight3238
Technical User
ok a new issue in my Word template VBA project. i'm trying to have the records from my database display in a combo box. earlier in my code i opened this database and grabed a single record. now when i try to grab all records for my list i get the single record from before repeated as many times as there are records.
Here is the code i'm using, what am i missing?
dbMain.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & "Data Source _
=c:\data\PhyList.mdb"
SQL = "SELECT LastName, FullName FROM Phy_List"
rsPhy1.Open SQL, dbMain, adOpenDynamic, adLockOptimistic
phyLName = rsPhy1("LastName"
phyFName = rsPhy1("FullName"
Do While Not rsPhy1.EOF
With cboJobSelection
.AddItem (phyLName & " - " & phyFName)
End With
rsPhy1.MoveNext
Loop
Here is the code i'm using, what am i missing?
dbMain.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & "Data Source _
=c:\data\PhyList.mdb"
SQL = "SELECT LastName, FullName FROM Phy_List"
rsPhy1.Open SQL, dbMain, adOpenDynamic, adLockOptimistic
phyLName = rsPhy1("LastName"
phyFName = rsPhy1("FullName"
Do While Not rsPhy1.EOF
With cboJobSelection
.AddItem (phyLName & " - " & phyFName)
End With
rsPhy1.MoveNext
Loop