Combo Box Only Displays Key Field (1 Viewer)

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
Hello,
I have a combo box on my form that is populated based on the value of 2 other combo boxes on the form. It has 2 columns, the Key field which is set to 0" width, and the MachName field which is set to 1" width.

My problem is that when the key field (column 1) is set to 0" width, nothing is displayed in the combo. When I set the Key field to ".5" both fields are displayed in the combo box, however, when a selection is made only the key is displayed in the form not the MachineName. I have attached a word document with print screens of my form and query.

Any suggestions would be appreciated very much!
 

Attachments

  • Machine cbo.pdf
    87.5 KB · Views: 82

theDBguy

I’m here to help
Staff member
Local time
Today, 12:42
Joined
Oct 29, 2018
Messages
21,551
Hi. What's in the Bound Column property? Have you tried creating a new combo just in case this one got corrupted?
 

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
I thought I posted a reply but I don't see it so excuse me if it appears twice.

My bound column is 1. I have deleted and re-created the combo box several times with the same result.

I attached some print screens of my form and query if that will help. My other 2 combo boxes work fine, so I'm wondering if the problem is that I am using criteria from 2 other combo boxes in the query. However, when open the form and select values from the 2 combo boxes referenced in the query and run it, it returns the correct data.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:42
Joined
Oct 29, 2018
Messages
21,551
I thought I posted a reply but I don't see it so excuse me if it appears twice.

My bound column is 1. I have deleted and re-created the combo box several times with the same result.

I attached some print screens of my form and query if that will help. My other 2 combo boxes work fine, so I'm wondering if the problem is that I am using criteria from 2 other combo boxes in the query. However, when open the form and select values from the 2 combo boxes referenced in the query and run it, it returns the correct data.
Hi. If the criteria is working, then it shouldn't matter if you hide the first column or not. I'm not sure I can figure out what's happening with your combo without being able to see it in action. Are you able to post a sample copy of your db?
 

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
I'll try to post it tomorrow. I will have to mock up some data.

Thank you so much for your input.
 

Micron

AWF VIP
Local time
Today, 15:42
Joined
Oct 20, 2018
Messages
3,478
The underlying field in the table is a lookup field?
 

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
Hello, I'm sorry, I didn't have time to log in yesterday. My tables don't contain any lookup fields so that's not the issue. Also, since my database is on my work PC I am unable to post a copy due to company policy. I did find a work around though. I created a text box and set the visible property to False and placed it over the combo box. I set the text box value to the Machine Name field. After the selection is made in the combo box the text box value is set to Visible = True. Not the best solution, but it will work.



I would really like to know why this issue is occurring, so I am going to try to make time to create a database on my home PC and re-create the problem so that I can post it.



DBguy & Micron, I really appreciate your input. The contributors to this site are awesome! Thanks again.
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:42
Joined
Sep 21, 2011
Messages
14,470
Also, since my database is on my work PC I am unable to post a copy due to company policy. I did find a work around though.

.

Is that for the data only?. Any problems with copying just the structure?
 

Micron

AWF VIP
Local time
Today, 15:42
Joined
Oct 20, 2018
Messages
3,478
If data is the issue, I posted a data randomizer at accessforums.net. Once used the data can't be unscrambled and if you've set referential integrity, related records will be scrambled too.
I can look for a link later if you say you can use it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:42
Joined
May 7, 2009
Messages
19,246
set ColumnWidths = 0";2"

there is another property, ListWidth, set this to the Total width of the Columns, which is 2".

if you set the ColumnWidths to 0";1", then the ListWidth = 1".
 

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
Gasman good suggestion. I'll check with my manager on Monday to see if I can do that. Thanks!
 

freidaf

Registered User.
Local time
Today, 12:42
Joined
Aug 13, 2012
Messages
44
arnelpg - I have already tried your suggestion. When widths are set as you instructed, no data appears in the drop down box.

Thank you for your input. I am going to see if I can post the structure of the database on Monday.

Thanks to all..
 

June7

AWF VIP
Local time
Today, 11:42
Joined
Mar 9, 2014
Messages
5,497
I don't use dynamic parameterized query objects. I would use SQL statement with the dynamic parameters as combobox RowSource.

Cascading combobox with alias can be tricky. Have to set the key field with 0 width. Then perhaps just need to Requery the combobox - use form Current event. Then need to requery after a selection is made in either of the other comboboxes.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 15:42
Joined
May 21, 2018
Messages
8,607
My problem is that when the key field (column 1) is set to 0" width, nothing is displayed in the combo. When I set the Key field to ".5" both fields are displayed in the combo box, however, when a selection is made only the key is displayed in the form not the MachineName. I have attached a word document with print screens of my form and

what you are describing is normal behavior. You can show mutliple columns in pulldown, but only one selected column. There is no way to fake this with a combobox, you would have to fake it with a listbox.
 

Users who are viewing this thread

Top Bottom