Combo Bx Start Point (1 Viewer)

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
I have a combo box that lists times for an entire day at 15 min increments.
12:00 Am then 12:15 AM and so on

Most of the time the user start time is after 09:00 Am, but not always.
I have tried DefaultValue and while it does set the value when I click the pulldown on the control the list starts at the first entry in the table rather than where the DefaultValue is set so that you have to scroll the entire list to get your value.

Anyone have any ideas on how to deal with this

Thank you in advance
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Hi. Default Value may not be enough to make the value stick. Try assigning it instead. For example,
Code:
If Me.NewRecord Then Me.ComboboxName=#9:00#
Just a thought...
 

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
Hi. Default Value may not be enough to make the value stick. Try assigning it instead. For example,
Code:
If Me.NewRecord Then Me.ComboboxName=#9:00#
Just a thought...

That assigned the value. But when I click the pull down to change it to say 09:15 the list starts at 12:00 AM instead of 09:00 AM
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Interesting. Perhaps the only way is to actually "type" in the box.
 

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
That does not work either. Once the value has been set in the control the pull down always starts at the top
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Hi. I just did a quick test where I created a combobox and a button. The button assigns a value to the combo based on user input. I can see the value show up in the combo and when I click the dropdown, the list starts on the assigned value for me. I wonder if there's something else going on with your combo. Try creating a new form and combo just to test it out.
 

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
Just did that. No change.
I used the assign method to set to 09:00 AM
I the clicked the pull down on the control it started at 12:00 AM
For giggles and *&^%$ I navigated to an existing record. It also started at 12:00 AM even though the entered value was different than that
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Just did that. No change.
I used the assign method to set to 09:00 AM
I the clicked the pull down on the control it started at 12:00 AM
For giggles and *&^%$ I navigated to an existing record. It also started at 12:00 AM even though the entered value was different than that
Hi. You're obviously getting a different behavior than I do. Have you tried testing with a blank database? Just a thought...
 

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
Still the same. I have attached sample database
 

Attachments

  • Contacts.accdb
    512 KB · Views: 56

bdra2778

Registered User.
Local time
Today, 13:13
Joined
Feb 14, 2019
Messages
34
Hello, if you combo box its bound, you need to bound to a table, this table need to has 2 fields, Example "Id and Time". Bounded using access wizard and when the wizard ask for Order By, select Id. See the attached images.

Regards

Note: Attached your the file edited
 

Attachments

  • time1.png
    time1.png
    8.2 KB · Views: 56
  • time2.png
    time2.png
    7.4 KB · Views: 56
  • Contacts.zip
    22.5 KB · Views: 54
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Hello, if you combo box its bound, you need to bound to a table, this table need to has 2 fields, Example "Id and Time". Bounded using access wizard and when the wizard ask for Order By, select Id. See the attached images.

Regards
Hmm, I wonder if this could be considered a "bug?"
 

bdra2778

Registered User.
Local time
Today, 13:13
Joined
Feb 14, 2019
Messages
34
Hmm, I wonder if this could be considered a "bug?"
No, it is not a bug, what happens is that access orders the list of the field in ascending form by default.

I have already corrected your file, look at the attachments in the previous comment.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
No, it is not a bug, what happens is that access orders the list of the field in ascending form by default.
Hi. Please don't mind me. I'm happy you were able to find a fix for the OP, but I just fail to see how this reasoning explains what is happening here. I don't see the same behavior with numbers or text list items (at least I don't remember seeing them). Cheers!
 

bdra2778

Registered User.
Local time
Today, 13:13
Joined
Feb 14, 2019
Messages
34
I don't see the same behavior with numbers or text list items (at least I don't remember seeing them). Cheers!

Maybe you're right and I'm wrong, other times I've seen access order the field as it was typed in the table the first time.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:13
Joined
Oct 29, 2018
Messages
21,494
Maybe you're right and I'm wrong, other times I've seen access order the field as it was typed in the table the first time.
Hi. I was just wondering how come the order of the list items would matter? Wasn't the OP's original list ordered correctly anyway? If so, how come it didn't work until you added an ID field? I also tried simply assigning the time field as a PK, and it still didn't work.
 

CanWest

Registered User.
Local time
Today, 14:13
Joined
Sep 15, 2006
Messages
272
No, it is not a bug, what happens is that access orders the list of the field in ascending form by default.

I have already corrected your file, look at the attachments in the previous comment.

Yup and it works great. I had one problem in that I had to bind the control to column 2 but after that it all works.

Now I have to fix all the other forms that use that table. Yikes
 

bdra2778

Registered User.
Local time
Today, 13:13
Joined
Feb 14, 2019
Messages
34
Hi. I was just wondering how come the order of the list items would matter? Wasn't the OP's original list ordered correctly anyway? If so, how come it didn't work until you added an ID field? I also tried simply assigning the time field as a PK, and it still didn't work.

I had to do a trick (so to call it).
-First add the field "Id" in your table and enter the values according to the order as you want the Schedule.

CHANGES IN THE "MEETING" FIELD OF THE "CONTAC" FORM
-Modify the query that you had created in the "Row Source" property. Add the Id field and sort the query also through the Id field.
- Modify the "Dependent column" property from value 1 to 2. This tells Access to save the value of "TimeofDay" in the field and not "Id".
-Modify the "Number of Columns" property from 1 to 2 and also modify the "Column Width" property from 2,542cm to 0cm; 2,542cm.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:13
Joined
May 21, 2018
Messages
8,554
@ DBGuy,
The likely reason it worked for you and not the OP was that the Format Property of the combo needs to be Set to Medium Time to match the display. Yours probably matched when you built it. Now it converts the display to text. If you set the value say 7:15 PM it will scroll and highlight 7:15 PM. FYI, Bdra2778 did not fix the issue only reordered the values so that the times were sorted differently and 0900 was at the top. It was not selected or highlighted.
 

Attachments

  • ContactsMajPv1.accdb
    504 KB · Views: 51
Last edited:

Users who are viewing this thread

Top Bottom