+ Reply to Thread
Results 1 to 5 of 5

userform search and update

  1. #1
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    userform search and update

    In the attached sample I have a user form with a simple search and update function. I have a similar form that works fine and i copied the code and just renamed what i need and I'm having mixed results.

    Search button works the first time, but if I change the job number and click it again it doesn't populate. Here's the code for the search button:

    Please Login or Register  to view this content.
    The update button doesn't seam to be working at all. Here's the update code:

    Please Login or Register  to view this content.
    Thanks in advanced for any help with this!
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: userform search and update

    This line of code appears to be your problem:
    Please Login or Register  to view this content.
    "jobno" is the control name for the Job Number text box on your other form. So in the update form this line cannot find a control/variable called "jobno" and therefore performs the search in column C for a null string.
    Change that line to:
    Please Login or Register  to view this content.
    and all should work as expected.

    BSB

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: userform search and update

    One thing I noticed about your workbook is I have to click the button twice to get the form to show.
    If you change:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    this should then work with a single click.

    BSB

  4. #4
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    Re: userform search and update

    Thanks BSB that was it.

    I also noticed that this part of the code isn't working now:

    Please Login or Register  to view this content.
    its not pulling in the dates at all.

    also when i click the update it doesn't enter the proper date format. even though i have this assigned to that text box:...this code works in another form...but when i click on that text box it entes a date and comes up with an error.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: userform search and update

    The three lines of code you say aren't pulling in dates are in the other userform right? They appear to be working just fine for me.

    For the second question, I would use CDate on the line that stamps the date to the worksheet.
    Please Login or Register  to view this content.
    This will throw up an error if the field is blank but you can avoid that by using something like:
    Please Login or Register  to view this content.
    BSB

+ 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] VBA Userform - Search, Edit & Update functionality
    By camp2chiawa in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-15-2016, 03:43 AM
  2. Doing search and update in workbook with userform
    By jhinruiz28 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-04-2015, 03:13 AM
  3. On Userform, how to put Search, Delete, Add, Update buttons
    By TSHEPO19811 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-07-2015, 10:38 AM
  4. Userform ADD/SEARCH/UPDATE Features
    By BARENTINEMATT in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2015, 11:55 AM
  5. Get Userform with search and Update functions to work
    By aemden1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2014, 12:18 PM
  6. Coding Search and Update Command Button in an UserForm
    By sottojeromey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2013, 06:39 AM
  7. Search records from userform and update data list
    By craigw27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2013, 08:55 AM

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