+ Reply to Thread
Results 1 to 4 of 4

Variable not found & Runtime error 13

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    Alberton, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    30

    Variable not found & Runtime error 13

    I am creating a UserForm for users to complete to create a new account. I have the following boxes in my form:

    AccTypeCodeComboBox
    AccTypeDescrTextBox
    AccNumberTextBox
    AccDescrTextBox

    The code below runs on exiting the AccNumberTextBox.

    The line "ChkType = AccTypeDescrComboBox.Value" results in a Compile Error: Variable not found - "AccTypeDescrComboBox" is highlighted.

    The line "ChkNr = AccNumberTextBox.Value" results in a Run-time error 13: Type mismatch - "AccNumberTextBox" is highlighted.

    The runtime error only occurred after I added the section starting at "If IsNull(Me.AccNumberTextBox.Value) Then". Before that there were no runtime error.

    I need help with:

    1) As what must I define the variable "AccTypeDescrComboBox"?

    2) How do I check that "AccNumberTextBox is not empty?

    I would appreciate any suggestions you may have.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,086

    Re: Variable not found & Runtime error 13

    There seems to be some inconsistency in the way you refer to this object: AccTypeDescrTextBox.

    Is it a text box or a combo box?


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-06-2012
    Location
    Alberton, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Variable not found & Runtime error 13

    Thanks TMS

    I have corrected AccTypeDescrComboBox to AccTypeDescrTextBox. This has resolved the 'Variable not found' error.

    Now I only need to resolve the Runtime error.

    Regards
    Deon

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,086

    Re: Variable not found & Runtime error 13

    I would suggest you post a sample workbook.


    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Runtime error '53': File not found
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-03-2015, 02:36 PM
  2. Runtime error: File could not be found...even though I just opened it
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2013, 03:41 PM
  3. Replies: 1
    Last Post: 11-17-2012, 11:10 PM
  4. Runtime error 91 Objecr Variable of With block variable not set
    By s_ali_hassan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-04-2010, 05:28 AM
  5. Replies: 8
    Last Post: 02-17-2009, 02:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1