Solved

Access Combobox, Value result wrong

Posted on 2016-08-25
5
29 Views
Last Modified: 2016-08-26
Please see the simple database I have included.
The combobox of the included form is unbound and has as its source a simple table with a column named c_name (sorted ascending) and the id column, bound to column 0.
The forms data source is a query based on the table. The querie's criteria is set to a tempvar which holds the comboboxe's column(1) value.
This updates the form with the name and address of the combobox selection. Simple enough.
However, look at the bottom field of the included form. It will show you the combobox value vs the combobox column 1 value...
and they are different! So
This cannot be! Can someone please explain how to fix this problem? I have tried decompiling to no effect.

I inherited a project which has a form directly linked to a table with several comboboxes set up in an identical fashion and they are updating the table with incorrect values. Thank you.
Database9.accdb
0
Comment
Question by:JP_TechGroup
  • 3
  • 2
5 Comments
 

Author Comment

by:JP_TechGroup
Comment Utility
This has something to do with the bound column set to 0. Setting it 2 resolves the issue in this context.
0
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
I think your confusion is being caused because the ID is the second column of the query rather than the first.  So column(1) would be numeric.  What I don't understand is why the bound column is registering as numeric rather than text.  But once I changed the column order for the query and adjusted as below, the problem clears up.

Change the order of the selected columns.
Change the bound column to 1 (this is the unique ID for the RowSource - and if the control were bound, it would be the column that would be stored in the RecordSource)
Change the column widths to - 0", 1"
Change the expression that sets the TempVar

TempVars("id") = Me.cmb_id.Value
0
 

Author Comment

by:JP_TechGroup
Comment Utility
Yes, I actually left the column order as it was and made the bound column 2.
I then set the column count to 1, same result.
0
 
LVL 34

Expert Comment

by:PatHartman
Comment Utility
Sometimes you can get away with doing things like lying about the column count.  Other times you get bit.  Best to stick to standard methods and avoid potential issues and the confusion you cause people who must work on the app after yourself.  Good practice is "good" for a reason.
0
 

Author Comment

by:JP_TechGroup
Comment Utility
Agreed. Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

772 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

12 Experts available now in Live!

Get 1:1 Help Now