There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
blue screen boot computer connection cpu crash css dell display driver drivers email error ethernet excel firefox firefox 3 game hard drive hardware internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition printer problem problems router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
set value and text in a combobox


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
cherry_?!'s Avatar
Junior Member with 29 posts.
 
Join Date: Mar 2005
Experience: Intermediate
17-May-2005, 02:35 PM #1
set value and text in a combobox
Hi,

this is probably something I will kick myself for, but I have been going over and over it and ...well...help!

I have an excel worksheet with a combobox that lists 2 columns -location and location number. The combobox is filled via a named range that is populated via a odbc connection to access. The range appears to be populating correctly. What I would like to do is set a default value - based on the 2nd column - the location number, but I would like the box to display the 1st column - the location.

This mimics what happens when you click on the drop down and select it - the value is populated as the number and what the user sees selected is the name.

I have tried using the .value and the .text properties, but it gives me errors. Any ideas?

Thanks,
Cherry
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,589 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-May-2005, 02:39 PM #2
Cherry, I do not quite understand your question. What "default" value are you trying to set? If you want to use the data in the Combo you can set it in the combobox properties.
Number of columns, bound column, column width and output cell.
cherry_?!'s Avatar
Junior Member with 29 posts.
 
Join Date: Mar 2005
Experience: Intermediate
18-May-2005, 03:10 PM #3
The default really just means that the combobox is pre-set with information and the user does not have to select an option from the list, unless the default (pre-set info we give them) needs to be changed.

The information to default is based on a function that gets their User ID and then searches a table to find the Location and Location number setup for their User ID(which is working). I want the combobox to display the location and for the value to be the location number - set the combobox to their location information as though they had selected it manually from the drop down, but we are setting it based on their User ID. Does that clarify things?

Thanks for any help,
Cherry
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,589 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-May-2005, 03:48 PM #4
So does Excel know the ID when it opens the Worksheet with the Combo on it?
cherry_?!'s Avatar
Junior Member with 29 posts.
 
Join Date: Mar 2005
Experience: Intermediate
18-May-2005, 04:52 PM #5
As part of the Workbook Open action, it finds out their ID and checks that it is valid and returns their location info.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,589 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-May-2005, 04:55 PM #6
So what does Excel do with the value/text chosen in the Combo?
When you set the Combo.value to their ID what happens?
cherry_?!'s Avatar
Junior Member with 29 posts.
 
Join Date: Mar 2005
Experience: Intermediate
26-May-2005, 11:11 AM #7
I was choosing the wrong variable to set the value (I knew I would have to kick myself)- once I selected the correct variable with (with the location ID) it is now showing the location name correctly.

So this is solved. Thanks for the help.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:02 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.