+ Reply to Thread
Results 1 to 17 of 17

Run-time error '1004' with vba for sequential auto-number for database entries

  1. #1
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Run-time error '1004' with vba for sequential auto-number for database entries

    Hello all,

    I'm having an issue with a userform I'm trying to reverse engineer for different purposes. A Run-time error '1004' comes up stating "Application-defined ir object-defined error," comes up when I try and run the userform. I've included the code and userform I got from someone else. This is the piece of the puzzle I'm stuck on for now. . . I'm sure I'll be asking for more help shortly after this issue is resolved. Thanks in advance for all the help. The members of this forum are amazing.

    Please Login or Register  to view this content.
    Auto-Number Example.xlsm

    -Orestees
    P.S. I'm still very new at VBA so I'm not familiar with all syntax yet. Thanks for the patience.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Hello ,

    I suspect the line below is causing the problem.
    Please Login or Register  to view this content.
    The brackets around A2 tell VBA to evaluate the cell. This is not a good practice to do without first validating the cell. What is this cell supposed to contain?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Unfortunately I'm not completely sure since I copied this code from another source (no explanation was given for what cell A2 should contain). My best guess is that it's representing the auto-number for recall purposes?

    The ultimate goal is to use the userform for data entry and include a time-stamp and unique transaction ID. This would be saved into the excel 'database' and then using the unique transaction ID, recall the data into the proper userform for editing and re-time-stamping (edited time-stamp) with the same ID. So far, this project has been a veritable Frankenstein of code from a ton of sources.
    Last edited by Orestees; 08-29-2012 at 05:00 PM.

  4. #4
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Didn't read anything in the rules against bumping. . . So. . . Bump.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Bumping is OK. You didn't read far enough down - it's close to the bottom of the rules page:

    If your question has not been answered within a day, consider adding another post with any additional information you believe is relevant. If you think your post is good as is, just reply to your own thread with the words "Bump no response", which will bring it to the top of the forum.
    Last edited by Cutter; 08-30-2012 at 12:51 PM.

  6. #6
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Thanks Cutter.

    Bump no solution yet.

    -Orestees

  7. #7
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Bumptastic!

  8. #8
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Bumpty Dumpty. . ."Bump no response"

  9. #9
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Bump no response. . . . Anybody. . . Anybody. . . . Bueller?

  10. #10
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Autonumber (BROKEN).xlsm

    Here's a copy of the form. Hopefully this helps. The only thing I'm really wanting to get out of it is the ability to create an autonumber. Thanks in advance for any more help since I'm at an impasse.

    -Orestees

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Hello Orestees ,

    See if this workbook does what you want.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Sorry Leith, couldn't find any macros within this doc. Not sure if I'm doing something wrong

    -Orestees

  13. #13
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Looks like the prior excel doc is .xls, not .xlsm.

    Bump

  14. #14
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    bumper cars. . .

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Hello Orestees,

    The document should run under any version of Excel. If you are having problems then load the workbook and resave it as xlsm.

    With macro enabled files, you must set your Trust Center settings to allow the macros to run.

  16. #16
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Sorry Leith, I've tried a few different ways to get macros working; Trust Center is good, macros enabled, renamed .xlsm, etc. . . but to no avail. Is there a way to save it on your side as a .xlsm? Also, not sure if it matters but every time I open it, it says that it's locked from editing and I have to enable it each time. Wondering if this is causing an issue.

    Thanks again for all of the help and your patience.
    -Orestees

  17. #17
    Forum Contributor
    Join Date
    07-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Run-time error '1004' with vba for sequential auto-number for database entries

    Leith,

    Got the autonumber issue taken care of via another post. The solution works via formating of the cells the data will be placed into but I'm still hoping there's a way to do it via userform.
    Thanks again for all your help!

    Ṃran taing

    P.S. Sorry Cutter, not solved but "worked around" in the meantime

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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