Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    3

    Need Help Formatting a field.

    Hello,


    Newbie here. I need some help formatting a field in an ACCESS table.
    I have the following fields in my table:

    1. YEAR <== entered by user
    2. SET NUMBER <== entered by user
    3. SLIDE NUMBER <== entered by user
    4. INVENTORY NUMBER <== want this to be automatically filled in

    I want to be able to format the 4th field so that the data is actually a combination of the 1st, 2nd, and 3rd fields.

    Example
    1. Year = 2007
    2. SET NUMBER = CM-A
    3. SLIDE NUMBER = CM-04

    I want the display for #4 INVENTORY NUMBER to be like the following -
    "2007_CM-A_CM-04"

    Notice that I have inserted two underscore characters ( _ )

    I am assuming that this can be done with either the format or input mask property pieces of the INVENTORY NUMBER field, but I do not know how to code for this. Can someone offer a suggestion?

  2. #2
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    It's generally not recommended storing a calculated field in a table.
    If all you want to do is to display the combination of three other fields, I would use an unbound field and concatenate the three fields together.

    =[YEAR] & "_" & [SET NUMBER] & "_" & [SLIDE NUMBER]

  3. #3
    Join Date
    Dec 2007
    Posts
    3
    jya,
    I understand a little bit about concatinating and yes, what you posted is exactly what I want to accomplish. I am not quite sure if I am doing it right though because it doesn't seem to work. I think I am missing a tiny part. You posted;

    Code:
    =[YEAR] & "_" & [SET NUMBER] & "_" & [SLIDE NUMBER]
    do I need to put something in front of this to direct the code to my specific form?? For instance;

    Code:
    MYFORM=[YEAR] & "_" & [SET NUMBER] & "_" & [SLIDE NUMBER]
    secondly, would this code go in the input mask or the format portion of the field in question?

    Thanks again in advance for any help.

    Butch Jones

  4. #4
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    Butch,

    The code does not go in a Table. I am assuming that you are displaying this information in a text field on a Form. If you have a Form that gets its data from your Table, add a text field to your Form. The code I gave would go in 'Control Source' under the 'Data' tab of that text field's property source. There is no need to store the information in a Table since it can be generated from information already in your Table.

    Hope it makes sense.

  5. #5
    Join Date
    Dec 2007
    Posts
    3
    jya,
    Your last response was so good that It was too easy and I was overlooking what you said. BUT, I did find the exact place you were talking about. I entered the code that you wrote and presto-chango, it WORKS!!!

    1000 thank you's......

    Not being familar with Access yet, I was not clicking on the right things to bring up the Property tab and therefor never saw the DATA tab that you were talking about. But I then went back and reread your response and then slowly went back into my form and it all clicked into place.

    THANKS AGAIN !!

    Butch

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums