+ Reply to Thread
Results 1 to 5 of 5

Date format from textbox to filter - text to date formate issues

  1. #1
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Date format from textbox to filter - text to date formate issues

    In the attached the search form works from all textbox's apart from the four date (textbox 3,4,5 and 6).

    I suspect it is the format of the date, I think the create record form enters the dates as text, but the search form when looking for >= date is a date so finds nothing or finds the wrong information....

    This is one of the biggest code files I have worked on mostly with the help from forums - my skills have been stretched any help would be appreciated.







    Data Table - Dummy.xlsm

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

    Re: Date format from textbox to filter - text to date formate issues

    Convert the Text-date from the textbox to a Serial-date for the search criteria.
    Please Login or Register  to view this content.

    This replaces TextBox_Change event procedure to the TextBox_Exit event procedure so the date is not validated while the user is typing. It's validated when the user exits the textbox.
    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
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: Date format from textbox to filter - text to date formate issues

    I have added this into my file.... thanks AlphaFrog for that.

    If I use the new record form to add new record it adds the dates into the columns with general format (not a date format).

    The search form is finding the new record but not as a date (I think its text/date problem), looking into this further if i use the filter option on the worksheet it sees the original dates as dates and the new dates as text.

    I need the search function on the date cells to look for greater than or equal to, all the others a exact match.

    I think I have created this problem with the way the whole file has evolved with snippets learned from searching rather than knowing what I am doing.

    I can add the amended file if needed, but it will have to be after work.

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

    Re: Date format from textbox to filter - text to date formate issues

    When you write a new record, you'll also have to convert the Text-dates from any textbox to Serial-dates.

    E.g.;
    Range("C100").Value = DateValue(Me.TextBox3.Text)

  5. #5
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: Date format from textbox to filter - text to date formate issues

    AlphaFrog thank you for you continued help.

    The add form I changed the line to:-

    Please Login or Register  to view this content.
    The view forms Amend and Duplicate line I changed the line to :-

    Please Login or Register  to view this content.
    But the search form I changed to

    Please Login or Register  to view this content.
    but then in the search clear code I added:-

    Please Login or Register  to view this content.
    Thank you again, could see the error but had no idea how to fix.

+ 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] Date Format Issues (US date vs European date)
    By MattyG1406 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2015, 05:39 AM
  2. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  3. [SOLVED] Formate( date, dd/mm/yyyy) use making my dates today's date
    By Pradeepg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2013, 06:57 AM
  4. Replies: 1
    Last Post: 12-11-2013, 10:35 AM
  5. Excel:How change the textbox format from text to date format?
    By inpetto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 08:23 AM
  6. Adding one TextBox with weeks to text box with date to give final Date
    By davidloops in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2013, 08:25 PM
  7. textbox to Cell date format issues
    By Panic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2008, 03:06 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