Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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
  #1 (permalink)  
Old May 2nd, 2006, 01:27 PM
Authorized User
 
Join Date: May 2006
Location: Nederland, TX, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default combo box saves Number of Values

Greetings
Here is an odd event, I've created a combo box with values from
a field in another table. I Used ADO to save the value to another table.
Instead of saving the (Name) value, it saved the number value.

Ex. I picked the forth name listed, it would save the number 4
instead or the persons name shown. Here is the code:
        Rst.Fields("TOTALEngr") = cboTOTALEng.Value
What is going on here and how can I fix this?
Thanks


John Paul Hailey
__________________
John Paul
  #2 (permalink)  
Old May 2nd, 2006, 02:22 PM
Authorized User
 
Join Date: May 2006
Location: Nederland, TX, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Folks, I just found the answer, The combo box was pulling a query from (2) fields, the ID and the Name. The first field (id)that
placed the info. I checked the ROW Source and the Column widths and found it. Once corrected the info was placed correctly!
thanks

John Paul
  #3 (permalink)  
Old May 3rd, 2006, 06:55 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you use the Combo Box wizard, it will display the value you select, and hide the primary key, and then bind to the PK field. If you either change the Bound Column to 2 (or which ever you want) or indicate which column you want in your code:

sVariable = Me.ComboBox.Columns(1)

then you won't have this problem. A good bit of detective work there.

mmcdonal


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show all values in a combo box in a report Odeh Naber Access 3 July 24th, 2007 07:37 AM
values in combo box Vince_421 Access VBA 8 May 10th, 2007 08:46 AM
Testing for NULL Values in a Combo Box Aaron Edwards Access 2 September 28th, 2005 09:37 AM
Combo box with different display and send values iniro VB.NET 2002/2003 Basics 3 November 9th, 2004 12:34 PM
Using values from a combo box as variables in SQL SoC Classic ASP Basics 7 July 20th, 2004 03:29 AM





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