Results 1 to 8 of 8

Thread: Type Mismatch Error

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Type Mismatch Error

    I have an double array which I would like to get the value of one of it's members and assign it to the To field of an outlook form. However, I receive a type mismatch: Employees Error.

    HTML Code:
    Function Item_Open()
    Dim FormPage, Control
    Set FormPage = Item.GetInspector.ModifiedFormPages("Message")
    Set Control = FormPage.Controls("TypeCombo")
    Control.PossibleValues = "Sign In;Lunch Out;Lunch In;Sign Out"
    
    Dim Employees(30,5)
    Employees(0,0) = "John"
    Employees(0,1) = "[email protected]"
    
    
    End Function
    
    Sub Item_CustomPropertyChange(ByVal Name)
    Dim FormPage, Control
    Set FormPage = Item.GetInspector.ModifiedFormPages("Message")
    Set Control = FormPage.Controls("TypeCombo")
    	Select Case Name
    	Case "TypeCombo"
    
    		SupervisorEmail = Employees(0,1).value
    
    		If Control.ListIndex = 0 Then
    			Item.Subject = "Sign In"
    			Item.To = SupervisorEmail 
    		End If
    		
    		If Control.ListIndex = 1 Then
    			Item.Subject = "Lunch Out"
    			Item.To = SupervisorEmail 
    		End If
    
    		If Control.ListIndex = 2 Then
    			Item.Subject = "Lunch In"
    		End If
    
    		If Control.ListIndex = 3 Then
    			Item.Subject = "Sign Out"
    		End If
    		
    	End Select
    
    End Sub
    
    
    
    

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Type Mismatch Error

    Take off the ".value".
    Code:
    SupervisorEmail = Employees(0,1)

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Type Mismatch Error

    Same error.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Type Mismatch Error

    I don't see SupervisorEmail declared? Could that be the problem?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Type Mismatch Error

    Doh. didnt catch that but even with that change it gives the same error.


    Dim SupervisorEmail
    SupervisorEmail = Employees(0,1)

    If Control.ListIndex = 0 Then
    Item.Subject = "Sign In"


    Could it be something with the way I am assigning the array item to something I would think expects a string... Which begs the question is there a toString() equivalent or need for one?

    For this line. SupervisorEmail = Employees(0,1)

  6. #6
    Addicted Member
    Join Date
    Apr 2009
    Location
    Toronto, Ontario
    Posts
    242

    Re: Type Mismatch Error

    All of your variables don't have a type defined. Perhaps it will help if you set the specific types of your variables.

    Cheers.
    -Elio
    ---
    REMEMBER: If your issue is resolved, use the Thread Tools menu to set it as such, and be sure to rate the posts that help you the most!


    Just because I was jealous of g4hsean!

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Type Mismatch Error

    Maybe move Dim Employees(30,5) to the top of your script as a global declare. It's scope may only apply to the Item_Open function -- I'm not a vbscript guru, just applying an educated guess.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Type Mismatch Error

    Apparently that was it Just needed to move the declaration to the top of the script. Thanks !

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