+ Reply to Thread
Results 1 to 14 of 14

Verify that record dosen't exist on user form text box entry

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Verify that record dosen't exist on user form text box entry

    On a user form i'm trying to verify that the entered part number in the text box "txtPartNo" doesn't already exist in a seperate workbook (Column F holds the part number). If the entered part number does exist then i display a message via msg box that a record does exist and it then references the specific planning number via the dpti variable (the planning number is in column A) in the same message box, we would then exit the sub and user form.

    If no record of the part number exists in the seperate workbook then we can continue entering the remainder of the user form info.

    When i enter a part number in the text box upon enter i immediately receive a "run time error 13", Type mismatch, not sure what i'm doing wrong, anyone have a suggestion?

    At the end of the day I'm just trying to ensure that we don't have duplicate part numbers in the workbook.

    Please Login or Register  to view this content.
    Last edited by jprlimey; 10-16-2014 at 04:37 PM. Reason: Solved

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Verify that record dosen't exist on user form text box entry

    Where in the code do you get the error?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify that record dosen't exist on user form text box entry

    Hi jprlimey

    It seems to me Column A would be Offset -5 from Column F, and you probably can't use ActiveCell.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by jaslake; 09-30-2014 at 01:05 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Verify that record dosen't exist on user form text box entry

    Norie,

    it hangs up here

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Verify that record dosen't exist on user form text box entry

    I can't see anything wrong with that, all the arguments and the values you are setting them to seem proper and correct.

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  6. #6
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Verify that record dosen't exist on user form text box entry

    Norie,

    I created a much smaller version of the original workbook, however the functionality is the same and to no surprise the result is still the same, you will need to enter a part number into the text box part number to trigger the "UpdateAfter" event.

    Hope you can help solve this mystery.
    Attached Files Attached Files

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify that record dosen't exist on user form text box entry

    Hi jprlimey

    Wrong Column
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jaslake; 09-30-2014 at 05:33 PM.

  8. #8
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Verify that record dosen't exist on user form text box entry

    jaslake,

    I see the issue, so now it shows the message box with the correction you suggested. However the variable dtpi is empty, any thoughts?

    Please Login or Register  to view this content.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify that record dosen't exist on user form text box entry

    Hi jprlimey

    Change the first Message Box Code...
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Verify that record dosen't exist on user form text box entry

    Sorry it's taken a few days to get back.

    Still have the problem, after following the suggestion in the latest post, the dtpi variable is still empty, any further thoughts?

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify that record dosen't exist on user form text box entry

    Hi jprlimey

    It appears to work for me...see attached...
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Verify that record dosen't exist on user form text box entry

    jaslake,

    I finally resolved my issue! The problem was on my end, something really stupid, i had misspelled the variable dtpi, once i corrected this everything worked fine, thanks so much for your assistance.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Verify that record dosen't exist on user form text box entry

    There's a way to avoid that sort of thing, add this at the top of each module.
    Please Login or Register  to view this content.
    With that in place you will be notified of any undeclared variables.

    PS You can set VBA to automatically add Option Explicit to each module by going to Tools>Options... and selecting Require Variable Declaration on the Editor tab.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify that record dosen't exist on user form text box entry

    Hi jprlimey

    You're welcome...glad I could help. Thanks for the Rep.

    Take Norie's advice...it's what I do. Saves a LOT of heartburn.
    You can set VBA to automatically add Option Explicit to each module by going to Tools>Options... and selecting Require Variable Declaration on the Editor tab.

+ 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. User Form Matrix Cell Selection - Does it exist?
    By FMontgomery in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2013, 05:41 PM
  2. Insert Rows Based on text Box Entry in User Form
    By aqhibjaveed2183 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 02:44 AM
  3. [SOLVED] Making a User form text entry box show when a checkbox is selected
    By delaneybob in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-02-2012, 07:24 PM
  4. Add next record using user form
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2010, 02:15 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