Microsoft Office Tutorials and References
In Depth Information
Creating a Contacts Database
'Verify if contact already exists in the table¶
If .EOF Then¶
'New contact, start new record¶
.AddNew¶
End If¶
'Set field values¶
.Fields(0).Value = objContact.EntryID¶
.Fields(1).Value = objContact.FullName¶
.Fields(2).Value = objContact.Email1Address¶
.Fields(3).Value = objContact.Email2Address¶
.Fields(4).Value = objContact.Email3Address¶
.Fields(5).Value = objContact.WebPage¶
.Fields(6).Value = objContact.BusinessTelephoneNumber¶
.Fields(7).Value = objContact.BusinessFaxNumber¶
.Fields(8).Value = objContact.HomeTelephoneNumber¶
.Fields(9).Value = objContact.MobileTelephoneNumber¶
.Fields(10).Value = objContact.PagerNumber¶
.Fields(11).Value = objContact.MailingAddress¶
.Fields(12).Value = objContact.MailingAddressCity¶
.Fields(13).Value = objContact.MailingAddressCountry¶
.Fields(14).Value = objContact.MailingAddressPostalCode¶
.Fields(15).Value = objContact.MailingAddressPostOfficeBox¶
.Fields(16).Value = objContact.MailingAddressState¶
.Fields(17).Value = objContact.MailingAddressStreet¶
.Fields(18).Value = objContact.Categories¶
'Update and close the recordset¶
.Update¶
.Close¶
End With¶
'Release object variables and free memory¶
Set objRs = Nothing¶
End Sub¶
' * * * * *¶
Private Sub OpenDatabaseInAccess()¶
'Access Application Object declaration¶
Dim accApp As Object¶
On Error GoTo ErrHandler¶
'Create an Access Application¶
Set accApp = CreateObject("Access.Application")¶
'Open contacts database¶
With accApp¶
.Visible = True¶
.OpenCurrentDatabase strFileName¶
.DoCmd.OpenTable tblName¶
End With¶
MsgBox "Access database has been opened."¶
ErrHandler:¶
If Err.Number = 429 Then¶
'MS Access is not installed in this system¶
MsgBox "You must have MS Access installed to " & _¶
"open database in Access." & vbCrLf & _¶
Out
Search JabSto ::




Custom Search