Combobox issue

Posted on 2016-11-12
Medium Priority
Last Modified: 2016-11-15
I don't think I've run into this before.  I have a form that has a combobox.  The combobox row source is a select query that gets its records from a table.  The table has a new yes/no field named "Inactive".  If a record has the yes/no field marked "True" then the record does not show up in the combo-box.  This is the way it should work for new records on the form.

But the problem is, for any existing records, when the form displays a record, the combo-box displays nothing.  I would like it to display the value if it is not a new record even if the combobox record is marked "True".

Ho do I get around this issue?
Question by:SteveL13
  • 2
LVL 24
ID: 41884650
There is only one RowSource for the combobox so the list is the same for all records. Perhaps instead of filtering out the inactive records, you can sort them to be at the bottom and show Inactive in another column. On the BeforeUpdate event of that control, test the Inactive column and if it is True, then give the user a message that they must pick an active value and Cancel the BeforeUpdate event to give them a chance to change their selection.

Optionally, you can modify the RowSource of the combobox depending on what you want for each record.  I prefer the above method.

Author Comment

ID: 41884697
I just had an idea and would like to know what you think.  In addition to the combobox I have created a text box with a DLookup control source to get the value of the combobox when the record was created.  I have the text box and the combo box on top of each other.

Then I have this code in the oncurrent event of the form...

    If Me.NewRecord = False Then
        Me.txtDeal.Visible = True
        Me.cboDeal.Visible = False
        Me.txtDeal.Visible = False
        Me.cboDeal.Visible = True
    End If

Open in new window

LVL 59

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 total points
ID: 41884780
<< I have created a text box with a DLookup control source to get the value of the combobox when the record was created.  I have the text box and the combo box on top of each other.>>

 Good idea using two controls, but rather than a text box, a third option is to use two combo's and switch between them.

 The other two options are the ones Crystal suggested.

  I like the approach of using a single combo, with all options, then use BeforeUpdate to test active/inactive.   While not the best approach from a UX viewpoint, it's the most efficient overall.

LVL 24

Accepted Solution

crystal (strive4peace) - Microsoft MVP, Access earned 1000 total points
ID: 41884943
rather than actually showing the user the inactive value of True or False, you can use an equation to show something more meaningful. Perhaps something like:
Inactive_: IIF(Inactive=true, "Inactive","")
Activ: IIF(Inactive=true, "","A")
CanPick: IIF(Inactive=true, "","Yes")

Open in new window


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question