Solved Item not in the collection of Combo Box but shown as default value (2 Viewers)

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
Hi everybody.
I have a Combobox and I want user to see "--SELECT ONE--" or something similar without adding this item into underlying table before clicking on it to see the rest of the items.
Also I believe it makes sense to see all items in the list excluding "--SELECT ONE--" when user clicks on a combo box, right?

Is there any preset property in Property Sheet that I can set up for? If not please tell me what is the best solution?
Thanks
Silversun
 

vba_php

Forum Troll
Local time
Today, 17:11
Joined
Oct 6, 2019
Messages
2,880
Is there any preset property in Property Sheet that I can set up for?
don't believe so. perhaps you could look this up:


and then maybe this, which is the first return:

 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:11
Joined
Jul 9, 2003
Messages
16,282
A combobox has a "Default Value" property but not sure can be used in the way you describe.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
Hi everybody.
I have a Combobox and I want user to see "--SELECT ONE--" or something similar without adding this item into underlying table before clicking on it to see the rest of the items.
Also I believe it makes sense to see all items in the list excluding "--SELECT ONE--" when user clicks on a combo box, right?

Is there any preset property in Property Sheet that I can set up for? If not please tell me what is the best solution?
Thanks
Silversun
Hi. Not in front of a computer now, but there are two things I think you could try. 1. Use the Format property, 2. Use a UNION query.

Sent from phone...
 

Micron

AWF VIP
Local time
Today, 18:11
Joined
Oct 20, 2018
Messages
3,478
I want user to see "--SELECT ONE--" or something similar without adding this item into underlying table
I would think the combo would have to be unbound, otherwise, any choice made will write to the table if the record is saved. IMO, most combos are used for filtering or record navigation and shouldn't be bound anyway. Some people who do bind them wonder why field entries change when somebody plays with the combo. Was going to mention the union query, but too late...
 

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
Hi. Not in front of a computer now, but there are two things I think you could try. 1. Use the Format property, 2. Use a UNION query.

Sent from phone...
I will wait for you to get in front of your computer. The Format Property gives me option to select one of the values as Default Value but it MUST be one of the items in the list that user can select. Union query, I am not sure how I can use it to my benefit in this problem. Please explain whenever you can.
Thank you
 

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
A combobox has a "Default Value" property but not sure can be used in the way you describe.
The Format Property gives me option to select one of the values as Default Value but it MUST be one of the items in the list that user can select which is not my option.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:11
Joined
Jul 9, 2003
Messages
16,282
As DbGuy said, a union query might be just the job, see here:-

Combo Filter < All> or Some
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
I will wait for you to get in front of your computer. The Format Property gives me option to select one of the values as Default Value but it MUST be one of the items in the list that user can select. Union query, I am not sure how I can use it to my benefit in this problem. Please explain whenever you can.
Thank you
Hi. The UNION query approach has already been explained, so I'll just show you what I meant about using the Format property.

Here's what the combo looks like when I open the form:
comboformat.png

Here's what it looks like when I click on the dropdown arrow (Notice "Select one..." is not in the list of choices):
combodrop.png


To prove that, here's the Row Source property:
combolist.png


And here's what I meant about using the Format property:
comboprop.png


Hope that helps...
comboformat.png combodrop.png combolist.png comboprop.png
 

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
Hi. The UNION query approach has already been explained, so I'll just show you what I meant about using the Format property.

Here's what the combo looks like when I open the form:
View attachment 80833
Here's what it looks like when I click on the dropdown arrow (Notice "Select one..." is not in the list of choices):
View attachment 80834

To prove that, here's the Row Source property:
View attachment 80835

And here's what I meant about using the Format property:
View attachment 80836

Hope that helps...
View attachment 80833 View attachment 80834 View attachment 80835 View attachment 80836
I tried your method in Format Property. It works for a combo box with row source defined as "Value List". My combo box has a query as row source and this method doesn't work.
1586749681538.png

Thank you for your help anyways.
I am still trying to figure it out. I am not sure about Union query, not familiar with this method.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:11
Joined
May 7, 2009
Messages
19,245
you can also try "textbox watermark" as suggested by vba_php.
this one is simpler.
go to new record and move to OrderNumber or Remarks field.
 

Attachments

  • sampleCueBanner.zip
    30.7 KB · Views: 103

onur_can

Active member
Local time
Today, 15:11
Joined
Oct 4, 2015
Messages
180
Hi friends
Set the line source of the combobox as the list of values at the beginning and apply the event that the dBguy has mentioned. Then type the code that will change the Row source to the event when the ComboBox is entered.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
I tried your method in Format Property. It works for a combo box with row source defined as "Value List". My combo box has a query as row source and this method doesn't work.
View attachment 80839
Thank you for your help anyways.
I am still trying to figure it out. I am not sure about Union query, not familiar with this method.
Hi. Just curious, how many rows does your combobox have as a result of your query?
 

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
Hi. Just curious, how many rows does your combobox have as a result of your query?
Not too many. I have 10 rows at most.
Thanks for all suggestions. I am going to work now and will try all you said when I am back.
Silversun
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
Not too many. I have 10 rows at most.
Thanks for all suggestions. I am going to work now and will try all you said when I am back.
Silversun
Okay, with only 10 rows, I think you can still consider the Format approach with a value list using my SimpleCSV() function. Just a thought...
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 18:11
Joined
May 21, 2018
Messages
8,529
This approach may give you more flexibility because you can use formatting for the "Select One". Using a textbox
Code:
Private Sub cmboSelected_AfterUpdate()
 ShowHide
End Sub

Private Sub Form_Current()
 ShowHide
End Sub

Private Sub txtSelect_GotFocus()
 Me.cmboSelected.SetFocus
End Sub
Private Sub ShowHide()
   Me.ID.SetFocus
   Me.txtSelect.Visible = (Trim(Me.cmboSelected & " ") = "")
End Sub
selectOne.jpg
 

Attachments

  • SelectOne.zip
    52.9 KB · Views: 108

MajP

You've got your good things, and you've got mine.
Local time
Today, 18:11
Joined
May 21, 2018
Messages
8,529
I just downloaded Arnelgp's post and this is the same idea just slightly different implementation. His version sets the width which is a better idea since you do not have to worry about focus issues.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
I tried your method in Format Property. It works for a combo box with row source defined as "Value List". My combo box has a query as row source and this method doesn't work.
View attachment 80839
Thank you for your help anyways.
I am still trying to figure it out. I am not sure about Union query, not familiar with this method.
Hi. Back in front of a computer and gave it a try using a query/table, and here's my result.

comboprops.png


combodrops.png


It seems to work for me, so I don't understand why it didn't work for you.
 

silversun

Registered User.
Local time
Today, 15:11
Joined
Dec 28, 2012
Messages
204
This approach may give you more flexibility because you can use formatting for the "Select One". Using a textbox
Code:
Private Sub cmboSelected_AfterUpdate()
ShowHide
End Sub

Private Sub Form_Current()
ShowHide
End Sub

Private Sub txtSelect_GotFocus()
Me.cmboSelected.SetFocus
End Sub
Private Sub ShowHide()
   Me.ID.SetFocus
   Me.txtSelect.Visible = (Trim(Me.cmboSelected & " ") = "")
End Sub
View attachment 80862
Hi,
Thanks for responding.
I downloaded your database sample and unlike what you have in my computer it shows Cat instead of "-Select One-". Please see the snapshot here:
1586825050938.png

I believe there should be something wrong with my Access settings because the property settings theDBguy suggested works on his computer but it is not working in my computer. Is there anything you can suggest to solve this issue or at least track it?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:11
Joined
Oct 29, 2018
Messages
21,474
...
I believe there should be something wrong with my Access settings because the property settings theDBguy suggested works on his computer but it is not working in my computer. Is there anything you can suggest to solve this issue or at least track it?
Hi. The only thing I could offer right now is, if you could post a demo version of your db, we can take a look at it. Otherwise, I'll be willing to do a web meeting with you.
 

Users who are viewing this thread

Top Bottom