Results 1 to 9 of 9
  1. #1
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Time values in combo boxes.


    I need to store time values for a full day in two separate comboboxes (24 hours in each) for start time and end time selection, 15 minute increments. Is it better to use a value list for these times and set the field value for date/time in the table...or use a value list with an index; time value and store the field value as a number/index for the combobox? I need to be able to retrieve this value for reporting. I'm new and trying to normalize my db

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    I vote for date/time type and store the time.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Re: Time values in combo boxes.

    and use a value list of the time values? June

    Thanks!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    If using a combo or list box and not just a textbox, ValueList or a table of the time values as the RowSource.

    I've never actually had to do this, so did a quick test. Value list seems to work: 6:00 PM;6:30 PM;7:00 PM;7:30 PM

    So I expect a table as source of the list would as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Re: Time values in combo boxes.

    I know both would work, but is there a proper way to do this, out of the two methods, that is better for performance/size/normalization?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    The advantage of table is if you want to add more items then don't have to modify the combobox, just add record to table. Performance will not be different in either method. The table is insignificant regarding size and as for normalization, that is not related to how the combobox is built.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If I had the choice I would create a table for the time. Because the time you are storing will most likely include a semicolon and an AM or PM I would create a primary key value of integer type and store that value as an FK. I would create a table for times much like I would create a table for states. I usually lean towards tables instead of value lists so I even use a different naming convention for these tables. Instead of tblStates or tblTimes I would use lstStates or lstTimes.

    Using a date picker for a bound control to store the date and a separate field as the FK of a table for the times seems like a good approach for your situation.

  8. #8
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Re: Time values in combo boxes.

    Why would the value contain a semi colon?

    Right now I have the value list of the times I need in the combo boxes and the bound field is time/date. There is no key being used. Can you justify why you prefer your method?

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by BRZ-Ryan View Post
    Why would the value contain a semi colon?
    Because I am confused and typed the wrong thing.

    There is not a right or wrong answer to which method you use. You try and predict the future and implement what will work best in the long run.

    Storing text in key fields can be cumbersome when dealing with many records and or querying the field from many places/objects within the app. Today you only need to query it once or twice and then, two years from now, you may need to query the key field from 12 places.

    In short, it is easier to expand with tables. Imagine building another input form that requires this value list. Now, you either build it from scratch or find that form you built previously so you can copy it. Compare that to simply using the table object.

    Use it how you have it built now. The work is done and that is what is important. If you need to work on it some more at a later date, you can reconsider at that time.

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

Similar Threads

  1. Replies: 13
    Last Post: 10-25-2012, 06:15 PM
  2. Enabling Disabling Combo Boxes from Values
    By vdanelia in forum Forms
    Replies: 3
    Last Post: 02-04-2011, 10:09 AM
  3. Restricting values in combo boxes
    By Remster in forum Access
    Replies: 4
    Last Post: 09-08-2010, 12:24 PM
  4. Replies: 1
    Last Post: 03-27-2010, 06:13 AM
  5. Replies: 2
    Last Post: 08-24-2009, 10:36 AM

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