I have a form that contains all my soccer player data. I would like to save the same in outlook contacts. I have used the following code to do the same. However, I am able to input only 1 record and that record alone. Can you help me out. Thanks.
Dim db As Database
Dim rsdata As Recordset
Dim objoutlook As Outlook.Application
Dim objcontactitem As Outlook.ContactItem
Dim i As Integer
Set db = CurrentDb
Set rsdata = db.OpenRecordset("tblplayers")
Set objoutlook = New Outlook.Application
Set objcontactitem = objoutlook.CreateItem(olContactItem)
Do Until rsdata.EOF
With objcontactitem
.FullName = rsdata("lastname") & " " & rsdata("firstname")
.HomeAddress = rsdata("address")
.HomeAddressCity = rsdata("city")
.HomeAddressState = rsdata("state")
.HomeAddressPostalCode = rsdata("zip")
.HomeTelephoneNumber = rsdata("phone")
.Save
End With
rsdata.MoveNext
Loop
Dim db As Database
Dim rsdata As Recordset
Dim objoutlook As Outlook.Application
Dim objcontactitem As Outlook.ContactItem
Dim i As Integer
Set db = CurrentDb
Set rsdata = db.OpenRecordset("tblplayers")
Set objoutlook = New Outlook.Application
Set objcontactitem = objoutlook.CreateItem(olContactItem)
Do Until rsdata.EOF
With objcontactitem
.FullName = rsdata("lastname") & " " & rsdata("firstname")
.HomeAddress = rsdata("address")
.HomeAddressCity = rsdata("city")
.HomeAddressState = rsdata("state")
.HomeAddressPostalCode = rsdata("zip")
.HomeTelephoneNumber = rsdata("phone")
.Save
End With
rsdata.MoveNext
Loop