Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2005
    Posts
    27

    Arrow Unanswered: Query in design view-add "19" to front of number

    Hey...I'm not as familiar with Access as I should be. I think this is simple, just can't figure out how to do it.

    I'm doing a query in design view. I have some 2 number years...83, 94, etc. I want to add "19" in front of them. So "83" becomes "1983", and "94" becomes "1994", etc.

    How would I do my update query so it will add the 19 to the front of each field?

    Thanks for any help!

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Do you want text, date or number as the result?
    Also important: what is the current format of the data, text or number?

    These assume YourField is a number:

    For a text result:
    YourResult: "19" & Format([YourField])

    For a number result:
    YourResult: 1900 + [YourField]

    For a date result, you'll need more than just the year as a date includes the month and day:
    YourResult: Date("Jan 1, 19" & Format([YourField]))

    hope this helps,
    tc

  3. #3
    Join Date
    Jun 2005
    Posts
    27
    Darn it, I knew I should have mentioned the type of field.

    It's a text field, actually.

    I'll try "19" & Format([YourField]) and see what happens. I think that will work, looking at it.

    Thank you!

  4. #4
    Join Date
    Jun 2005
    Posts
    27
    Awesome. It worked.

    Thank you! I knew it was something simple.

    Edit: new, knew, gnu . Don't cha love typos?
    Last edited by domini; 04-18-06 at 18:42.

  5. #5
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    PS: if the field is text, and you don't mind getting text as your result, then:

    "19" & [YourField]

    will work fine (the Format function converts a number to text, and since it's text already, the function isn't needed).

    tc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •