Solved

How to edit columns in Combo Box based on user selection

Posted on 2013-02-02
4
312 Views
Last Modified: 2013-02-04
Hi All

I have a three-column combo box, the first two columns are visible, and the third is an invisible Boolean field.

I would like to write VBA code in the combo box's AfterUpdate event that for whatever record the user selects, for the hidden column the selected row value is True, and all other row values to False.

Thanks in advance.
Jim
0
Comment
Question by:Jim Horn
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 38847661
try something like this

private sub combo0_afterUpdate()

usql = "update table1 set selected=-1 where id=" & me.combo0
currentdb.execute usql

usql = "update table1 set selected=-1 where id<>" & me.combo0
currentdb.execute usql


end sub

selected is the third cp;umn of your combo, id is the bound column of the combo
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38847873
What is the Row source type of the combo?
0
 
LVL 65

Author Comment

by:Jim Horn
ID: 38850834
>What is the Row source type of the combo?
It's a query that's based on a SQL linked table.
 
I'll go with Cap's answer unless I hear otherwise, as I was favoring an answer that manipulated the combo box via VBA, to avoid any second-combo-box-dropdown refresh issues, but I suppose refreshing after the above SQL calls wouldn't be that big of a deal.
0
 
LVL 65

Author Closing Comment

by:Jim Horn
ID: 38852647
Thanks.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

759 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