Professional Web Applications Themes

Unbound text box as label - Microsoft Access

I have an application form that is used from year to year for the same agencies. I want to create a label that displays the year the form is used. I have an unbound text box and I want to write code that will look at the date field on the form and bring back a label for the year. I think the code is something like this: Dim strFund If [Application Date] > 1/1/2001 and < 12/31/2001 then strFund = "2001" else if [Applicaiton Date] > 1/1/2002 and < 12/31/2002 then strFund= "2002" I am not a programmer, please ...

  1. #1

    Default Unbound text box as label

    I have an application form that is used from year to year for the same
    agencies.
    I want to create a label that displays the year the form is used. I have an
    unbound text box and I want to write code that will look at the date field
    on the form and bring back a label for the year.

    I think the code is something like this:

    Dim strFund

    If [Application Date] > 1/1/2001 and < 12/31/2001 then strFund = "2001"
    else if [Applicaiton Date] > 1/1/2002 and < 12/31/2002 then strFund= "2002"

    I am not a programmer, please excuse any gross errors. Can you please help
    me? Thanks much!!!
    LAR-S


    lars Guest

  2. #2

    Default Unbound text box as label

    You can display a value of a textbox control that is bound
    to a date field several ways.

    By far the simplest is in the properies window of the form
    enter YYYY in the format property. This will do the job
    for you.

    You can also format the control with Format([Application
    Date],"YYYY") either in the format property of in your
    code.

    The 3rd way is: Year([Application Date]) which will also
    have the same result.

    The last 2 can also be applied to the Recourd Source if
    the source is a query.

    Bish...
    >-----Original Message-----
    >I have an application form that is used from year to year
    for the same
    >agencies.
    >I want to create a label that displays the year the form
    is used. I have an
    >unbound text box and I want to write code that will look
    at the date field
    >on the form and bring back a label for the year.
    >
    >I think the code is something like this:
    >
    >Dim strFund
    >
    >If [Application Date] > 1/1/2001 and < 12/31/2001 then
    strFund = "2001"
    >else if [Applicaiton Date] > 1/1/2002 and < 12/31/2002
    then strFund= "2002"
    >
    >I am not a programmer, please excuse any gross errors.
    Can you please help
    >me? Thanks much!!!
    >LAR-S
    >
    >
    >.
    >
    Bish Guest

  3. #3

    Default Re: Unbound text box as label

    Thanks for your answers.

    In the case of a fiscal year where the actual dates cross from one year into
    another, I would need the formula. Example being July 1, 2002 through June
    30, 2003.

    "Joan Wild" <jwildnospamtyenet.com> wrote in message
    news:ugqU9pJRDHA.3880tk2msftngp13.phx.gbl...
    > Just set the control source of the textbox to
    > =Year([Application Date])
    >
    > --
    > Joan Wild
    > Microsoft Access MVP
    >
    > "lars" <lrstoneco.santa-barbara.ca.us.nospam> wrote in message
    > news:OhJlTfJRDHA.2332TK2MSFTNGP10.phx.gbl...
    > > I have an application form that is used from year to year for the same
    > > agencies.
    > > I want to create a label that displays the year the form is used. I
    have
    > an
    > > unbound text box and I want to write code that will look at the date
    field
    > > on the form and bring back a label for the year.
    > >
    > > I think the code is something like this:
    > >
    > > Dim strFund
    > >
    > > If [Application Date] > 1/1/2001 and < 12/31/2001 then strFund = "2001"
    > > else if [Applicaiton Date] > 1/1/2002 and < 12/31/2002 then strFund=
    > "2002"
    > >
    > > I am not a programmer, please excuse any gross errors. Can you please
    > help
    > > me? Thanks much!!!
    > > LAR-S
    > >
    > >
    >
    >

    lars Guest

  4. #4

    Default Re: Unbound text box as label

    Just set the control source of the textbox to
    =Year([Application Date])

    --
    Joan Wild
    Microsoft Access MVP

    "lars" <lrstoneco.santa-barbara.ca.us.nospam> wrote in message
    news:OhJlTfJRDHA.2332TK2MSFTNGP10.phx.gbl...
    > I have an application form that is used from year to year for the same
    > agencies.
    > I want to create a label that displays the year the form is used. I have
    an
    > unbound text box and I want to write code that will look at the date field
    > on the form and bring back a label for the year.
    >
    > I think the code is something like this:
    >
    > Dim strFund
    >
    > If [Application Date] > 1/1/2001 and < 12/31/2001 then strFund = "2001"
    > else if [Applicaiton Date] > 1/1/2002 and < 12/31/2002 then strFund=
    "2002"
    >
    > I am not a programmer, please excuse any gross errors. Can you please
    help
    > me? Thanks much!!!
    > LAR-S
    >
    >

    Joan Wild Guest

Similar Threads

  1. Animate when text label changes...
    By sripos in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: April 29th, 04:08 PM
  2. Changing text on asp-label
    By ReidarT in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 23rd, 11:16 AM
  3. aligning text in a asp label
    By Onur Bozkurt in forum ASP.NET General
    Replies: 0
    Last Post: July 25th, 09:39 AM
  4. easy one - label and text box
    By Ted in forum Microsoft Access
    Replies: 1
    Last Post: July 8th, 07:42 AM
  5. Unbound Text Box
    By Ken Snell in forum Microsoft Access
    Replies: 0
    Last Post: July 6th, 07:20 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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139