+ Reply to Thread
Results 1 to 14 of 14

Reload & edit data by unique ID number into Userform

  1. #1
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Reload & edit data by unique ID number into Userform

    Hi,

    Is there a way that I can recall the data that has been saved from a user form to a worksheet back into the original text boxes & combo boxes?

    Once there the user could make changes so it will need to be resaved over the old information, if possible.

    I have the unique code working and two command buttons in the top of userform that I want the code assigned to.

    Hope this makes sense, I'll attached my file if this helps.

    Cheers BJ5352
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Reload & edit data by unique ID number into Userform

    I can't see where the IDs are, but you should be able to use code from the Databaseform example
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    Thanks Roy,

    The ID's are generated by code sitting in module 2 and are only entered into the data worksheet once the save button is clicked by code in that button.

    I'll have a look at the link you listed and see if I'm able to adopted to suit my form.I'll let you know how I go.

    Cheers BJ5253

  4. #4
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    No luck, I loaded the coded in but I'm getting a run time error 424 "Object Required" each time you press the "Load" button.

    Do you know would caused this? I have re-atatched the file with the new code added in.

    Cheers BJ5352
    Attached Files Attached Files
    Last edited by BJ5352; 08-30-2010 at 01:51 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Reload & edit data by unique ID number into Userform

    Which load button?

    I would suggest that you tidy up the appearance of the form. A userform is supposed to help a user input the information. There's no structure to your form, it's just an untidy collection of input boxes & labels, very difficult to follow

  6. #6
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    The button is in the top left corner labeled "Load".

    The form is actually broken up into relevant areas, but as this is my first use of a form I'm open to suggestion.

    Cheers BJ5352

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Reload & edit data by unique ID number into Userform

    When the error occurs you should click debug to finf the problem line. In this case the following line is highlighted.

    Please Login or Register  to view this content.
    A quick look at the objects in the Project Explorer shows there is no Sheet with the Code name Data, so you need

    Please Login or Register  to view this content.
    Last edited by shg; 09-01-2010 at 11:39 PM.

  8. #8
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    Still no go, now I get a runtime error '1004" with the new code

    The same line is highlighted as before thats causing the error.

    Please Login or Register  to view this content.
    Any ideas as to why the code want work?

    Please Login or Register  to view this content.
    I also cleaned up the layout of the form, I think its a whole better now. Thanks for the suggestion.
    Cheers BJ5352
    Attached Files Attached Files
    Last edited by BJ5352; 09-03-2010 at 03:34 AM.

  9. #9
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    Hi Guy's

    Still no luck with getting this code to work. Can anybody assist?

    CheersBJ5352

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

    re: Reload & edit data by unique ID number into Userform

    Hello BJ5352,

    The problem lies with the range "AW" reference. The range reference needs to be on the same sheet. You can write this a couple of ways...
    Please Login or Register  to view this content.

    It is a better programming practice to let VBA determine what the last row of the worksheet is. This will allow the same code to run on a 2003 worksheet or a 2007 worksheet.
    Please Login or Register  to view this content.
    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!)

  11. #11
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    Thanks Leith, That made all the difference, I had to make a few small changes after you mentioned the data had to be on the same sheet.

    The only problem now is when it saves the changes, it want start from the unique code number. Is there a way to make it find the unquie code on the active sheet and make that the active cell?

    The code I have is not working.

    Please Login or Register  to view this content.
    Cheers BJ5352

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

    re: Reload & edit data by unique ID number into Userform

    Hello BJ5352,

    The code will now search the ActiveSheet for the Unique Number and make it the ActiveCell. If the number is not found then an error message is displayed and the macro exits.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    re: Reload & edit data by unique ID number into Userform

    Yes, Well done first go works a treat.

    Can I add code for a MsgBox in to tell the user that the Changes have been Saved?

    Cheers BJ5352

  14. #14
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Thumbs up [Solved]Re: Reload & edit data by unique ID number into Userform

    All good I think I have worked the code out.

    Please Login or Register  to view this content.
    Thanks for all your help you saved the day.

    Cheers BJ5352

+ 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