Solved

Combobox issue

Posted on 2016-11-12
4
32 Views
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?
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 19
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.
1
 

Author Comment

by:SteveL13
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
    Else
        Me.txtDeal.Visible = False
        Me.cboDeal.Visible = True
    End If

Open in new window

0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 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.

Jim.
1
 
LVL 19

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 250 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","")
or
Activ: IIF(Inactive=true, "","A")
or
CanPick: IIF(Inactive=true, "","Yes")

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TRIM a textbox value MS Access 10 23
count unique records in access report 2 23
Error in query expression 3 34
Access Excel export not behaving 2 25
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now