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

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).

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.

Specify Format / set up placeholder for multi-column ComboBox

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.

Can I create a drop-down list (as opposed to a combo box)?

Creating combo boxes in Access is easily enough. However, drop-down lists are slightly easier for users when there's no need to edit or add values to the list.
Is there a property I can set to make a combo box control manifest as a drop-down list? Is there a custom ActiveX control available with drop-down style?
See whether the combo box .Dropdown method gets you close to what you need. I cribbed this example from the Access help topic:
Private Sub SupplierID_GotFocus()
Me!SupplierID.Dropdown
End Sub
If I am understanding your phrase "manifest as a drop-down" correctly, I think you mean that you want to restrict the user to selecting from a set of pre-populated options only.
Provide a List of Approved Values to Select
For example, if you want them to select a Month, and there are only twelve valid entries Jan-Dec, you can provide a list of months from a query, table, or direct input into the Combo Box's Row Source property.
Keep the User from Adding New Values or Editing Existing Values
What I think you may mean by "manifesting as a List Box" is that you can also then restrict the user to only selecting from your provided values by setting the Limit to List property of the Combo Box to Yes. Setting this property will restrict your users to your list, and not allow edits or new list entries. Remember to take addition steps if you need to make sure the user has selected one of your list values.
Use Dropdown and an Event like On Got Focus together
The Dropdown method "opens" the list so that the user can see the available options. For example, you can set it to the control's On Got Focus Event property so that the user will see some or all available options when the focus is set to this control.
Best of luck!

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.

Access 2007 VBA : Building a listbox with selection choices from another list box

So there are 8 categories that may be associated to each order, but not necessarily all of them. So i was going to build a list box that allowed the user to double click each of the category they wish to associate when they have an "Order Detail" form opened up (unbound form that has hidden text boxes with all needed ID numbers).
I want to have another empty text box right beside it that will allow me to append the selections (up to 8) so the user can see that they have been added.
So one list box with the default choices, and when a choice is double clicked, it adds that choice to the second list box to see the tally so to speak.
What is the VB for getting something like this done?
Thanks
Justin
I suggest that you are making life difficult for yourself. Create a subform with the Order Detail table and a combobox that allows the user to select the various categories.
If you want two list boxes --- one for available choices and another for selected items --- and the ability to move items back and forth between available and selected, it can be done with VBA, but is not trivial. See How do I select items using dual list boxes? for an example.
Personally I favor Remou's suggestion if you can make that work for your situation.