Results 1 to 5 of 5

Thread: TypeMismatch, run time error 13...
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular albertc30's Avatar
    Join Date
    May 2012
    Location
    Norfolk
    Posts
    969
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question TypeMismatch, run time error 13...

    Hi all, again.

    If I can't do the simple thing, I will NEVER ever stand a chance at learning how to correctly code.

    Ok. There's a form that loads when a spreadsheet is clicked;

    Code:
    Private Sub Worksheet_Activate()
    
        CustForm.Show
    
    
    End Sub
    This form has 4 command buttons.

    One of these buttons are called New Customer (form name "adnecustomer", button name is "CBCusNewCus") and it should open the new customer form.
    Now this was working fine, till I done something but I don't have a clue on earth what did I do.

    Code:
    Private Sub CBCusNewCus_Click()
        
        CustForm.Hide
        adnecustomer.Show
        
    End Sub
    What on earth have I done to make the entire thing go crazy?

    All other two forms that were working fine have completely gone bonkers.

    Even though I have been meddling with vba excel coding for a few years now, I am pretty much a novice. This takes me through the night as I do love it and how it works. Sadly, I'll never amount to a brilliant coder I'm afraid.

    Again, any help is well and truly welcome and much appreciated.

    Please point out in the right direction.

    Regards,
    Carlos
    Many thanks for all the help, much appreciated.

    Regards,
    Albert

    Reminder
    Remember to use code tags people.

  2. #2
    Board Regular
    Join Date
    Feb 2006
    Location
    NJ, USA
    Posts
    354
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: TypeMismatch, run time error 13...

    try reversing these:

    Code:
    Private Sub CBCusNewCus_Click()
        
        CustForm.Hide
        adnecustomer.Show
        
    End Sub

    Code:
    Private Sub CBCusNewCus_Click()
    
        adnecustomer.Show   
        CustForm.Hide
    
        
    End Sub
    - Posting guidelines, forum rules and terms of use

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes

    Also, when asking questions, please be as detailed as possible, and If I have helped you, please let me know.
    I don't require thanks, but acknowledgement is nice

  3. #3
    Board Regular albertc30's Avatar
    Join Date
    May 2012
    Location
    Norfolk
    Posts
    969
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: TypeMismatch, run time error 13...

    Still won't have it.

    Still returns error

    run time error 13

    type mismatch

    and points out to adnecustomer.Show.

    This was working fine.

    What on earth did I do?

    Thanks for helping.

    Cheers.
    Many thanks for all the help, much appreciated.

    Regards,
    Albert

    Reminder
    Remember to use code tags people.

  4. #4
    Board Regular
    Join Date
    Mar 2013
    Posts
    793
    Post Thanks / Like
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)

    Default Re: TypeMismatch, run time error 13...

    Just a shot in the dark but I would try
    Code:
    Private Sub CBCusNewCus_Click()
        Stop
        CustForm.Hide
        adnecustomer.Show
    End Sub
    and after clicking the button and the code stops, use the F8 key to advance the execution of the code one line at a time and see if by chance it's something beyond this where the error occurs.

  5. #5
    Board Regular albertc30's Avatar
    Join Date
    May 2012
    Location
    Norfolk
    Posts
    969
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: TypeMismatch, run time error 13...

    HI mate.

    There was nothing wrong with my code that I have shared above.

    The issue, after hours of thinking was that I made the mistake of duplicating the form and then changed a few field names. Once I got to those and corrected them across the code forms are now loading and working.

    Another thing I just learned was that the "load form" does not actually show the form, instead it loads it into the memory. So having to use form.show rather than load form.

    Much appreciated for your help, as always.

    Cheers.
    Many thanks for all the help, much appreciated.

    Regards,
    Albert

    Reminder
    Remember to use code tags people.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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