+ Reply to Thread
Results 1 to 3 of 3

User Form value passing problem

  1. #1
    brusk2@uiuc.edu
    Guest

    User Form value passing problem

    Hopefully this is a simple fix, but for some reason I can't figure it
    out. I have a user from in which the user enters information through
    text boxes. One text box has characters and numbers, the rest have
    numbers. The one with mixed characters is a date. Specifically a
    month and year. The user is instructed to use an abbreviated form,
    i.e. June '06 or Sept. '06. The problem is that if the user inputs
    something like June 06 instead of June '06 (missing the apostrophe) or
    Sept 06 instead of Sept. 06 (no period), when I pass the value to a
    cell on a worksheet, I get a number. For example, July 06 = 38904 when
    passed using the code:

    Range("C27").Value2 = Me.txtMonth.Value

    I'd prefer to fix this without using data validation or anything like
    that. Thanks in advance for any advice!

    B


  2. #2
    Harald Staff
    Guest

    Re: User Form value passing problem

    If you get a number then everything works fine. Just format the cell in date
    format. Dates are really just numbers, counting number of days since new
    year to 1900 (or 1904). The real problem is when you /don't/ get a number,
    then it's just a date looking text and not a real date.

    Well maybe not. Maybe you don't want dates, just simple text. If so,
    preformnat the cell as text instead of date.

    HTH. Best wishes Harald


    <brusk2@uiuc.edu> skrev i melding
    news:1155138764.907332.109130@n13g2000cwa.googlegroups.com...
    > Hopefully this is a simple fix, but for some reason I can't figure it
    > out. I have a user from in which the user enters information through
    > text boxes. One text box has characters and numbers, the rest have
    > numbers. The one with mixed characters is a date. Specifically a
    > month and year. The user is instructed to use an abbreviated form,
    > i.e. June '06 or Sept. '06. The problem is that if the user inputs
    > something like June 06 instead of June '06 (missing the apostrophe) or
    > Sept 06 instead of Sept. 06 (no period), when I pass the value to a
    > cell on a worksheet, I get a number. For example, July 06 = 38904 when
    > passed using the code:
    >
    > Range("C27").Value2 = Me.txtMonth.Value
    >
    > I'd prefer to fix this without using data validation or anything like
    > that. Thanks in advance for any advice!
    >
    > B
    >




  3. #3
    SpartMan1
    Guest

    Re: User Form value passing problem

    Perfect, thanks for the fix and the info!

    Harald Staff wrote:
    > If you get a number then everything works fine. Just format the cell in date
    > format. Dates are really just numbers, counting number of days since new
    > year to 1900 (or 1904). The real problem is when you /don't/ get a number,
    > then it's just a date looking text and not a real date.
    >
    > Well maybe not. Maybe you don't want dates, just simple text. If so,
    > preformnat the cell as text instead of date.
    >
    > HTH. Best wishes Harald
    >
    >
    > <brusk2@uiuc.edu> skrev i melding
    > news:1155138764.907332.109130@n13g2000cwa.googlegroups.com...
    > > Hopefully this is a simple fix, but for some reason I can't figure it
    > > out. I have a user from in which the user enters information through
    > > text boxes. One text box has characters and numbers, the rest have
    > > numbers. The one with mixed characters is a date. Specifically a
    > > month and year. The user is instructed to use an abbreviated form,
    > > i.e. June '06 or Sept. '06. The problem is that if the user inputs
    > > something like June 06 instead of June '06 (missing the apostrophe) or
    > > Sept 06 instead of Sept. 06 (no period), when I pass the value to a
    > > cell on a worksheet, I get a number. For example, July 06 = 38904 when
    > > passed using the code:
    > >
    > > Range("C27").Value2 = Me.txtMonth.Value
    > >
    > > I'd prefer to fix this without using data validation or anything like
    > > that. Thanks in advance for any advice!
    > >
    > > B
    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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