+ Reply to Thread
Results 1 to 5 of 5

Runtime error on UserForm

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

    Runtime error on UserForm

    I have the following code attached to a button:

    Private Sub Add_Acc_Click()

    NewAccountUserForm.Show

    End Sub

    (sorry, I do not know how to put it in code tags)


    When I click the button, I get the error message:

    Runtime error '-2147467259 (80004005)':
    Unspecified Error

    It worked fine before, but I have changed the name of 1 field and added a new field. Since then I have been getting this error.

    I would appreciate any help in resolving this error.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Runtime error on UserForm

    When the error occurs, click Debug, then press F8 and step through the code until it errors again. Then investigate the conditions of that line.

    Post back when you have more details.
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Runtime error on UserForm

    Goeie Naand, DJvdW,

    Please could you upload a sample Workbook, with your complete Code and changes, for us to have a look at for you.

    That takes away any guess work, on our side.

    Baie dankie.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

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

    Re: Runtime error on UserForm

    Hi Tinbendr

    I have followed your advice and found the error occurs on initializing the form (see code below). I have remarked out the offending line, and everything works fine now. Could the error have been due to me setting the RowSource property for the ComboBox?

    Private Sub UserForm_Initialize()

    'AccTypeCodeComboBox.Clear
    AccTypeDescrTextBox.Value = ""
    AccNumberTextBox.Value = ""
    AccDescrTextBox.Value = ""
    AccTypeCodeComboBox.SetFocus

    End Sub

    Thanks for your help

    Quote Originally Posted by Tinbendr View Post
    When the error occurs, click Debug, then press F8 and step through the code until it errors again. Then investigate the conditions of that line.

    Post back when you have more details.

  5. #5
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Runtime error on UserForm

    Could the error have been due to me setting the RowSource property for the ComboBox?
    Yes. You can't clear, add, delete, etc items from a combobox/listbox when it's tied to a rowsource. (That's why I rarely use rowsource. But if it works for you, then go for it.)

+ 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. Getting runtime error when sub executed through userform change rather than directly
    By drew.j.harrison in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-28-2013, 12:32 AM
  2. RunTime error with UserForm!.Show
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-03-2011, 09:42 AM
  3. runtime error 3265 error in a VBA Query to pull info from ERP Database
    By NBVC in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-12-2010, 03:59 PM
  4. Excel xmlHTTP object error message - system/runtime error
    By Porky2007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2007, 09:36 AM
  5. [SOLVED] Using For/Next Loop To Generate 4 CommandButtons On A UserForm Results In A Runtime Error 91
    By Donna in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2005, 10:06 AM

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