Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2005, 04:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default Combobox Showing Wrong Column

I have combobox whose rowsource type is set to Table/Query. Its rowsource is set to a query that displays five columns. The columns are sorted by first then second then third. The BOUND column property to the combobox is set to column five.

In VBA code, I am able to choose a value from the combobox and set the record of the form to match the value based on that fifth column value in the combobox list.

    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[strApp] = '" & Me.cboApp & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    Set rs = Nothing

This works. The catch? Well, after the combobox closes, it displays the value of the first column for that row, not the fifth.

I've checked the query, the bound column setting (5), the column width properties (0.5";1.5";0.25";4";1.5") and the column count property (5). Still, even though the bound column is no. 5 and the combobox's AfterUpdate event is working correctly, it still shows the FIRST column's value instead of the fifth in the combobox. I must be missing something obvious from staring at this too much.

Any clues?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
 
Old June 29th, 2005, 06:16 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Greg,
Do you store any of the 5 values anywhere after the fact?

Kevin


dartcoach
 
Old June 30th, 2005, 05:59 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had a similar problem with a list box. The problem was solved during the
wizard fase when the list box was beeing created. When asked where the value would have to be stored i answered that the PK would be the place. When closing the form i had some errors messages telling that the value couldn't be saved. I have silenced the errors messages and everything worked as expected. If there is a more technical solution to the problem i would like to know.
rgds Penta

 
Old June 30th, 2005, 07:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Kevin, no the values are not stored anywhere. The combobox is UNbound. The combobox is used merely as a look-up to make the chosen permit number off the list move the record pointer to that choice. When I created the combobox with the wizard, I chose "use that value later" or something like that.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old June 30th, 2005, 07:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

I was just informed by someone in another forum about what's going on. Check this out...

http://www.utteraccess.com/forums/sh...&Number=739590


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Solved-RS.FindFirst and Multiple Column ComboBox eusanpe Access VBA 0 May 19th, 2008 01:25 PM
not showing column in datagridview jomet .NET Framework 2.0 6 March 15th, 2008 04:02 AM
Datagridview & combobox column p2pmarit .NET Framework 2.0 1 July 31st, 2006 02:31 AM
2 column Combobox in ASP memnon33 Classic ASP Basics 4 May 31st, 2005 09:09 AM
Multiple column for combobox in C# twaghorn C# 1 July 14th, 2003 04:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.