+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    User Form Search and Update

    Not sure if I am linking this correctly but here it goes...http://www.excelforum.com/excel-prog...ification.html

    This is a previous post link that is now solved but I have a new question based on the code in the post. I would like to know how to add a search and update ability to the user form I have created. I am newb with user forms so I apologize in advance for my lack of knowledge.

    And yes I know the way it is set up now it is depositing data in two different locations; this is for a specific purpose.

  2. #2
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445

    Re: User Form Search and Update

    Take a look at the DatabaseForm example here

    http://excel-it.com/vba_examples.htm

    The earlier example already has code added using .Find, so you can also see how that works.It just needs applying to a Find button as the suggested example does
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  3. #3
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    Roy, thanks for the link. trying to implement the ideas into my userform. will repost the completed product when if I get it to work.

  4. #4
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    I have no idea what i did wrong, but when i tried to use the cmbFindAll piece of code i was suprised to see it wipe my entire workbook out. I dont just mean wiped out i mean gone. I can hit Alt+F11 and see the pages within the workbook but I can not access them. When i try and run a macro I get a global fail error message. I removed the code from my user form and saved but found no joy in this correcting the issue.

  5. #5
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445

    Re: User Form Search and Update

    Have you got a copy with the code in? I doubt if the code caused this, that's one of my top downloads, must be several thousand.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  6. #6
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    I had to start from a backup copy of my workbook. lucky for me there is only one minor change between the two copies so I didnt lose a lot of work. I will try to re-insert the code and see what happens.

  7. #7
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445

    Re: User Form Search and Update

    Add the code exactly as you did before,then attach it. I'll take a look
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  8. #8
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    ok so I have the workbook working 100%, but not the piece of code. this is how i modified it but i must be missing something as i get an error when i search.

    Code:
    Sub cmbFindAll_Click()
        Dim strFind As String    'what to find
        Dim rFilter As Range     'range to search
        Set rFilter = Part_Center.Range("a3", Range("f65536").End(xlUp))  '<------ Error occurs here'
        Set rng = Part_Center.Range("a4", Range("a65536").End(xlUp))
        strFind = Me.txtModel.Value
        With Bid_ToC
            If Not .AutoFilterMode Then .Range("A4").AutoFilter
            rFilter.AutoFilter Field:=1, Criteria1:=strFind
            Set rng = rng.Cells.SpecialCells(xlCellTypeVisible)
            Me.ListBox1.Clear
            For Each c In rng
                With Me.ListBox1
                    .AddItem c.Value
                    .List(.ListCount - 1, 1) = c.Offset(0, 1).Value
                    .List(.ListCount - 1, 2) = c.Offset(0, 2).Value
                    .List(.ListCount - 1, 7) = c.Offset(0, 7).Value
                End With
            Next c
        End With
    End Sub
    the sheet the parts are stored on is "Part_Center" the sheet the user form is on is "Bid_ToC" the first cell any part is listed on in the "Part_Center" sheet is A4 (A4:F4 makes up the current full line information for the first part)

  9. #9
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    any idea on how to make this work?

  10. #10
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445

    Re: User Form Search and Update

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  11. #11
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    attached a workbook that i have been using to test with.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    royUK..I have attached the requested example..hopefully you can help with this issue.

  13. #13
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    Still looking for a little help on this please.

  14. #14
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445

    Re: User Form Search and Update

    There's no Part Centre worksheet. What have you serched for & what ios the error message?
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  15. #15
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: User Form Search and Update

    The code I posted is from the actual workbook I am working on, the attachment I posted has the code set for the attached workbook and is my test book. The two are not the same in that respect but the code is relatively the same. But I am getting the same stop point in the posted example and the actual workbook.

    Run-time error ‘1004’-
    Method ‘Range’ of object’_Worksheet’ failed

    Code:
    Set rSearch = Sheet3.Range("a1", Range("a65536").End(xlUp))
    I have tried changing ‘Sheet3’ to “Customer_Information” in the attached example posted but the error is the same, so I am not sure what mistake I am making.

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.2.0