+ Reply to Thread
Results 1 to 7 of 7

Assigning Text Box Event through Class to required Text Box

  1. #1
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Assigning Text Box Event through Class to required Text Box

    Hi All,

    I am need of suggestion/debug on below part of code, as i unable to understand why code is not assigning event.

    Query is i have 1 list box in that list for some value we required textbox and based on that label and textbox will visible and the position of label and text box is not fixed and for the last value of denied reason list we have 3 text box respectively and i want to add keydown event to that textbox below is the code for that.

    Click on EOP Notes tab --> Click on Denied reason and click on value from the list and for last 2 value we have text box and in that user will enter date, once user enter date the date format should be change to (dd-mmm-yyyy).

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,453

    Re: Assigning Text Box Event through Class to required Text Box

    you need to create a new instance of the object

    Please Login or Register  to view this content.
    Although that get you past your error it will not work as you expect. Because you have scoped the TextBoxes array within the routine once you exit objects will be released from memory, but the controls will still remain. You need to declare the array at the module level of the userform.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Assigning Text Box Event through Class to required Text Box

    Hi Andy Pope,

    i added that provided line in my code its pass the error,however the event not getting executed, could you please let me know how to over come with this. If possible could you please modify my code at required line.

    thank you !

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,453

    Re: Assigning Text Box Event through Class to required Text Box

    I did. You need to move the declaration of the TextBoxes array out of the list_change routine and put it at the top of the code module.

  5. #5
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Assigning Text Box Event through Class to required Text Box

    yes. i made TextBoxes as universal and its working fine, but only for "Audit Closure (Member)" text boxes, however for Audit Closure (Provider) its not working.

    i added OR at IF Condition to get event to both Provider and Member, however its getting only for Member.

    Please Login or Register  to view this content.

    or shall i add another Event in Class2. please suggest.

    please see the screen shot.
    Attached Images Attached Images
    Last edited by Naveed Raza; 03-18-2016 at 05:29 AM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,453

    Re: Assigning Text Box Event through Class to required Text Box

    Well I assume you uncommented that section of your code and added the new set command as per previous sugeestion

  7. #7
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Assigning Text Box Event through Class to required Text Box

    Hi Andy Pope.

    Thank you for your help its resolved.

    i added 2 different event for Provider & Member in Class now its working fine.

    Thank you !

+ 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] Simple Conditional Formating Help Required - If Blank then Red Bold text required
    By thilag in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-19-2014, 12:23 PM
  2. Replies: 11
    Last Post: 12-10-2012, 10:40 AM
  3. Copy Text to Text Box during Worsheet change event.
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2012, 09:07 AM
  4. Assigning value to text
    By Zan03 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-05-2010, 05:04 PM
  5. Assigning a 0 value to text
    By Steele in forum Excel General
    Replies: 3
    Last Post: 10-07-2008, 09:56 AM
  6. Assigning values to text - but displaying the text!
    By hudds in forum Excel General
    Replies: 4
    Last Post: 03-24-2007, 06:03 AM
  7. Assigning a value to a text
    By Eugine in forum Excel General
    Replies: 1
    Last Post: 03-13-2006, 07:31 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