Results 1 to 4 of 4
  1. #1
    parthoza is offline Novice
    Windows 8 Access 2007
    Join Date
    May 2016
    Posts
    2

    Formatting Formula

    I have a table database with various fields. I have 2 different classes that I want to keep track of and there are multiple sessions in each class. Example: I have Class A and Class B and each have Sessions 1 through 10. I am attempting to automate my table where if I enter A1, the field automatically formats to read "A - Session 1" or if I enter B10, the field automatically reads "B - Session 10". In the design view, I currently have this field formatted as a Short Text Data Type. I have tried 2 different Format types that each partially give me what I want.
    • Format Type 1: @" - Session "@@ When I enter B10, the Output is what I am looking for "B - Session 10" BUT when I enter a single digit session, say B9, I get " - Session 9" without the initial "B" in front of the dash.
    • Format Type 2: @" - Session "@ When I enter B10, the Output turns into B1 - Session 0 BUT when I enter a single digit session, say B9, I get "B - Session 9" which is what I am looking for.




    It appears that when the sessions go into double digits, the formatting gets messed up. Anyone have any suggestions for the correct format I need to use so it works for single and double digit sessions?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    your class needs another field, [caption] to show when you select B10. Formatting not needed.

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You only need one format.

    Set the format to "!@ - Session @@", and it works fine. When you use "@", the places are filled from right to left by default; using the "!" in front causes the places to be filled from left to right, which is the way you want it.

  4. #4
    parthoza is offline Novice
    Windows 8 Access 2007
    Join Date
    May 2016
    Posts
    2
    Quote Originally Posted by John_G View Post
    You only need one format.

    Set the format to "!@ - Session @@", and it works fine. When you use "@", the places are filled from right to left by default; using the "!" in front causes the places to be filled from left to right, which is the way you want it.
    Thanks John!

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

Similar Threads

  1. Formula Help
    By bstack10 in forum Access
    Replies: 2
    Last Post: 04-18-2016, 03:13 AM
  2. Replies: 2
    Last Post: 11-12-2015, 10:46 AM
  3. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  4. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  5. Conditional Formatting vs. VBA Formatting
    By gopherking in forum Reports
    Replies: 5
    Last Post: 11-09-2011, 06:53 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