Results 1 to 9 of 9
  1. #1
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117

    Format for a field


    Hey guys, I posted this before on my other thread which was not the the problem but now it is.

    I have a table with a field TR_ID. On the form when a new record is created it takes the last id and adds by 1 which works good. For example I create a new record and goes to 60 automatically on the form field. But how do I get "TR-" in the begging of the number so the format is "TR-60" on the form field. I tried from the other thread but didn;t work. If somebody can list step by step where to type in the information in table or field on form and what to type in. Thanks all help is appreciated!

  2. #2
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    Is the field set up as a text or number field

  3. #3
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Text field

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    ...when a new record is created it takes the last id and adds by 1...
    How does it do that, if the field is a text field? ID fields are normally numeric if you want to do any type of mathematical manipulation with them, and it makes using them in queries much easier.

    If you want to see that ID as TR-xxx in forms, reports or queries, then you set the format to display "TR-" before the number.

    On a form, set the Format property of the textbox to "TR-"000 (I know that looks a little strange, but that is what Access used when I tried it).

    In a query, use the Format function: Format([TR_ID], "TR-000")

  5. #5
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Did not work, I didn't do it through a query and I tried putting that in the property tab in format and did not work, any other suggestions?

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It didn't work -

    OK, but what did it do, i.e. what did the form show in the ID textbox?

  7. #7
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    it did absoluty nothing, it just showed the number like it did before

  8. #8
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    it did absoluty nothing, it just showed the number like it did before
    Something isn't right here - I can't see why it wouldn't work. Did you change the ID field to numeric as was suggested? I don't think it's that, but it might be.

    What exactly did you put in the Format property of the textbox?

  9. #9
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Ok it worked, I had to change the data type to number, Thanks a lot!

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

Similar Threads

  1. Format field for Min:Sec.000
    By JimO in forum Access
    Replies: 6
    Last Post: 03-12-2016, 08:06 PM
  2. Replies: 6
    Last Post: 06-26-2015, 08:55 PM
  3. Replies: 4
    Last Post: 03-12-2013, 06:49 PM
  4. Number Field Format.
    By cap.zadi in forum Reports
    Replies: 2
    Last Post: 12-04-2011, 10:17 PM
  5. Change field format
    By zhshqzyc in forum Access
    Replies: 6
    Last Post: 01-20-2011, 04:07 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