+ Reply to Thread
Results 1 to 3 of 3

Form listbox error when date is not entered

  1. #1
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Iowa
    MS-Off Ver
    2007
    Posts
    212

    Form listbox error when date is not entered

    Hello all,
    I have a user form setup to allow editing/updating records on a worksheet. The form has a list box that is used to display filtered records and then by clicking a record, its values are added to the form controls for editing. There are two date columns, one is for when the record is added to the worksheet, the other is left blank until the project is completed. Both are formatted as custom date (mm/dd/yyyy).

    It's the second, blank date field, that is causing a type-mismatch error when the record is clicked on in the list box. I know what the problem is (a blank cell is not a valid date), just not sure how to tell VBA to allow this to be blank until an actual completed date is added.

    Maybe adding an IF statement to skip over if blank?

    Thank you

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Form listbox error when date is not entered

    Replace this...
    Please Login or Register  to view this content.

    With this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Iowa
    MS-Off Ver
    2007
    Posts
    212

    Re: Form listbox error when date is not entered

    Thank you, works great.

+ 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. Outllok error !!!!"The end date you entered occurs before the start date".
    By hudson andrew in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 07-21-2016, 02:13 PM
  2. User Form ListBox - Find Records (ListBox Populating Issue)
    By LONeillSSC in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-20-2015, 12:06 PM
  3. Creating Date Tabs using dates entered via form
    By MartinF123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2014, 06:34 PM
  4. Edit code to loop error msgbox and inputbox until valid date is entered by user.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2012, 10:07 PM
  5. VBA code - simultaneous entry on different worksheet based on DATE ENTERED to form
    By sgtbash999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2012, 04:02 PM
  6. Replies: 0
    Last Post: 12-13-2011, 05:13 PM
  7. Invalid property error loading a form with a date selected form DTPicker
    By copernicus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2009, 04:17 PM

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