CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Location
    London, Ontario, Canada
    Posts
    20

    HELP! Run-Time Error '2144717851(80010105)'

    My VB program is used to manage contacts in stored in a public folder. The error only occurs the first time the program is run after a login. It happens when trying to create a contact on the .move event of a ContactItem. Here is some code, hopefully you can help me out!

    thanks in advance,

    Bonovox011

    Private Sub cmdCreate_Click()

    On Err GoTo errorHandler

    'Create an instance of Outlook
    Set objApp = New Outlook.Application

    'Create a namespace within Outlook so that I can access folders
    Set objNameSpace = objApp.GetNamespace("MAPI")

    'Make objContact a Conact Item in this instance of Outlook
    Set objContact = _
    objApp.CreateItem(olContactItem)

    'set the folder to a public folder "VF Contacts"
    Set objFolder = objNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("TIAS Public Folders").Folders("North America").Folders("United States").Folders("STR - Strathroy").Folders("VF Administration").Folders("VF Contacts")

    'Attribute all the fields of the form to a spot in the contact form
    With objContact

    .CompanyName = txtComName.Text
    .BusinessAddressStreet = txtBusStreet.Text
    .BusinessAddressCity = txtBusCity.Text
    .BusinessAddressState = txtBusState.Text
    .BusinessAddressCountry = txtBusCountry.Text
    .BusinessAddressPostalCode = txtBusPC.Text
    .BusinessTelephoneNumber = txtBusPhone.Text
    .OtherFaxNumber = txtBusFax.Text
    .FirstName = txtConFName.Text
    .LastName = txtConLName.Text
    .MobileTelephoneNumber = txtEmail.Text
    .Home2TelephoneNumber = txtWSIB.Text
    .HomeTelephoneNumber = txtInsurLiab.Text
    .TelexNumber = txtAttachS.Text
    .Department = txtAttachE.Text

    'Save the changes made
    .Save

    'Move them to the public folder
    .Move objFolder

    End With


    'Reset the Instance of Outlook to nothing
    Set objContact = Nothing
    Set objApp = Nothing
    Set objNameSpace = Nothing
    Set objFolder = Nothing

    'Display that Contact was created
    intQValu = MsgBox("Contact Created!", , "Vari-Form")

    'Ask User to Add another Contact or to continue
    intQValu = MsgBox("Create Another Contact?", _
    vbYesNo + vbQuestion, "Response Required")

    'if user press yes
    If intQValu = vbYes Then

    'call main form load to start program over again
    txtComName.SetFocus
    Call Form_Load

    Else

    'Display main menu
    Unload frmCreate
    frmMainMenu.Visible = True
    'Reset the Instance of Outlook to nothing
    Set objApp = Nothing
    Set objNameSpace = Nothing
    Set objFolder = Nothing
    Set objContact = Nothing

    Exit Sub

    End If

    'Reset the Instance of Outlook to nothing
    Set objApp = Nothing
    Set objNameSpace = Nothing
    Set objFolder = Nothing
    Set objContact = Nothing

    'exit sub to avoid error handler from running if everything is ok till here
    Exit Sub

    'error handler for any errors that occur
    errorHandler:

    'return a messsage box with error number and description
    intQValu = MsgBox(Err.Number & " " & Err.Description, , "Vari-Form")
    Err.Clear

    'set variables to nothing
    Set objApp = Nothing
    Set objNameSpace = Nothing
    Set objFolder = Nothing
    Set objContact = Nothing

    Call Form_Load

    Resume Next


    End Sub


  2. #2
    Join Date
    Jun 2001
    Location
    London, Ontario, Canada
    Posts
    20

    Re: HELP! I am Really Stuck!!!

    I can't figure out why it won't run the first time some logs in but as soon as you end the program and start again it works perfectly fine, I'm getting desperate.

    Thanks again,

    Bonovox011


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured