Specify Format / set up placeholder for multi-column ComboBox - ms-access

I want to show a placeholder in a ComboBox if no values has yet been selected or the previously selected one has been removed / deselected. For single-column ComboBoxes that works like a charm using #;"My placeholder" as the Format of the ComboBox. So far so good.
The problem starts if my ComboBox has more than one column. How can you set the placeholder value for a multi-column ComboBox? More general: How can you specify the Format for a multi-column ComboBox?
Is it for example possible to color the first column green and the second one red? And if it is possible, please tell me how.
I could not find any specification on how to set the format for multiple columns. Neither on MSDN nor on support.office.com.
P.S.: I do not care if a working solution relies on VBA or if it can achieved just by entering something in the layout or design view.

Sounds like you are outgrowing what a ComboBox can easily provide in Access.
First, combo options, and then my real suggestion.
Here are your ComboBox options:
Try conditional formatting, and see if you can get the combo's text box to change color if the value is null.
You could make a UNION query that appends your placeholder record to the top of your Combo's real recordsource
You could try to get your users used to the idea of 'blank' = null, and fix it with training.
I have never seen a way to do different combo column colors in Access.
My REAL suggestion:
Ditch the combo and go with a modal dialog form that pops up for the user. This will let you format everything much more closely to what you want.
You can put textboxes on your main form to display the placeholders.
The user clicks on the textbox to open your dialog form.

Related

connected combo boxes in continuous form - the second combo doesn't show its value if dependent on first combo how could I fix that

I have a Continuous Form that has two combo boxes. If I don't link them together all values appear but if I link the two combo boxes to make one of them depend on other for easier choose from, the values never show in the second combo. I try to make code with if condition in vba to requery the combo values to show in all records but I couldn't. How could I do that? Thank you for all what you do
This technique is known as cascading combobox. A very common topic. Be aware that if combobox RowSource uses an alias (displays text when saving ID) the text will not be available for display in all records when the list is filtered. This is especially disconcerting for users of continuous/datasheet view form.
Could have code that only filters second combobox when it gets focus then restore the full list when loses focus. Users will still see data briefly disappear from other records and may find distracting at first but will learn to disregard.
However, a workaround to maintain display of text is to include the combobox RowSource lookup table in a query used as form RecordSource. Bind a textbox to the descriptive text field from lookup table. Set textbox as Locked Yes and TabStop No. In continuous view, can size and position textbox on top of combobox to obscure combobox text but still show drop arrow (a "hybrid" control). In datasheet view the textbox will not be superimposed but text will be displayed.
If controls are superimposed, users accustomed to clicking into combobox text frame and typing input will encounter aggravation as the textbox will likely be the control they click. Tabbing to the combobox or clicking drop arrow will cause combobox to get focus and display over the textbox.

Set unbound combo box to match on full string for not in list event

I have an unbound combo box that gets it's row source values using a select query in VBA. The values shown are filtered by other selections on the form. If a value entered is not on the list I have a prompt to ask the user if they would like to add a new record. So far this has worked without any problems.
I overlooked one issue. If the "new" item is a partial match the selection defaults to the partial match entry. (Ex. I want to add part 4321437 but part 4321437-01 is already present.) How can I get the field to match using the full field?
I have tried playing with auto expand, allow value list edits, show only row source values, and inherit value list. Nothing seems to stop it from auto-filling. I have also tried clicking out of the field versus tabbing out.
If I remove my for key-down event that displays the list options with the arrow keys, it works. However, the customer would like to keep that feature.
Is there a way to have both?
Thinking outside the box, perhaps consider using a TextBox in place of a ComboBox.
This way, using the AfterUpdate event, you would have full control over how the entered value is handled: test for a match in your dataset using a simple query and branch accordingly.
You could even cycle through existing options by successively populating the TextBox with existing values from your dataset on the KeyDown event triggered by the arrow keys.
I found a way to have both. In my Key Down Event, I check if the down arrow is pressed. If it is, I display the drop down menu.
If KeyCode = vbKeyDown Then
Me![cboNewPart].Dropdown
End If

Access Form - how do I only display fields and cell values if the cell has data?

Could someone please help me with configuring my access database? I would like to use a combo-box at the top of the form where the user selects from the available work forms (Column 1 in Table) and then it displays who is involved in the form. Currently it displays every field and to reduce to the information displayed I would like it to only display information if the cell has a value in it.
Am I using the wrong tool? Should I be using a Report instead? How's my table data, too much?
Many Thanks
My current form
My wanted result
The way I normally hide empty fields is to change the label for a field to a control and set the control source to the following:
=IIf([FieldName]<>'', "My label:", Null)
Then I set the CanShrink property on both the "label" and the field to Yes.
Finally I make sure the section it's in (typically the detail but you may have reason to use something other) also has CanShrink set to Yes.
When you stack the controls on top of each other in this manner you should get the result as you posted.
Note: this only works for reports or if you print the results of a form. If you do not intend to allow entry of data into the form it would be better served as a report.

How to make a textbox display a different field than it controls?

So at the top of my page I have a combo box to select the current employee. The form is chiefly made up of checklist items to be completed. I set up a macro, so that when a checkbox next to the item is clicked, it will populate the 'CompletedBy' field with whatever value was in the combo box at the top of the page. That way they can select their name once, and then check off any items they have completed, and their respective name will be recorded for each item they have done.
HOWEVER I want it to DISPLAY the employees name, but actually manipulate the 'EmployeeID' field.
So how do I make a textbox display a value, but manipulate a different value in a table>? Or if this is impossible, what other paradigm could I use to accomplish this?
This is a tutorial on how to bind combo box to primary key but display a description field: this works on old version of Microsoft Access. I don't know if newer versions of Microsoft Access use a different and simpler approach (i.e.: .DisplayMember and .ValueMember properties of a ComboBox in VB.NET).

MS Access combobox in a continuous form changes value for all rows when I change value for one row

I've been trying to solve this issue for the past 2 hours but in vain...
So I hope that you can help me with a solution to this problem..
I have a continuous form that shows many rows at a time, I added a combobox to the form that shows some values to choose from another table, while having the default value shown from the same table. Problem is, as soon as I change the value in one of the comboboxes in the form, all the other comboboxes changes value to the same one as the latter...
How do I prevent that??
Thanks a million in advance
Tony's right. You can't do what you want with an unbound control.
However, it's not entirely clear what your intent is based on your question. If changing the combobox should update a field on the current record, then you just need to make it a bound control. You would do this by setting the combobox's ControlSource property equal to the appropriate field in the underlying table or query.
I faced similar issue and got it sorted recently. I had created a tabular form and had introduced a combo box in the form, picking up values from a value list. Whenever I used to select a value of this combo box list, the selection used to get reflecting on all the records. To correct this, you should do the following:-
1) Introduce the combo box field in the source table of your form. Instead of clicking on the drop down box in the tool box, click on the Add existing fields link on the ribbon and select the newly added combo box field from the table. This will add a combo box field and a corresponding label in the form area. For a tabular form, you may want to delete the corresponding label and introduce a non-linked label in the form header.
This solved the issue for me. Hope it will be of some value to you.
May be a couple of years late and am pretty sure that it's been long since you figured out this problem,but it's good to leave it in the thread for someone,who may be in need.
Can't be done. This is one of the limitations of Access continuous forms and unbound controls.
Because of this strange behavior I just hide that field.
In the datasheet view:
Right-Click the field header that matches your combobox
Select "Hide Fields"
Now the person can see the records and they can use the form. They don't need a field for the combobox.