Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Will combobox.ItemData accept a string

Posted on 2002-04-18
8
Medium Priority
?
302 Views
Last Modified: 2010-05-02
When I try to add a string to the ItemData array I get a type mismatch error. It accepts integers OK.

What is wrong.

Merlin007
0
Comment
Question by:merlin007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6951248
ItemData is a collection of LONG. You can't set it to strings.
0
 
LVL 5

Accepted Solution

by:
rkot2000 earned 200 total points
ID: 6951256
if you want to store a string, you need to create an array of strings and store item index in the itemdata propery.

0
 
LVL 4

Expert Comment

by:nutwiss
ID: 6951501
yup.... unfortunately they're both right... it can be a pain..

I usually use the itemdata to store a bookmark from a recordset when the combo is populated, then if I wish to retrieve the record relevant to whatever is selected in the combo, I can simply use

Recordset.Bookmark = combo.itemdata(combo.listindex)
and pull whatever data direct from the recordset
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:nutwiss
ID: 6951507
ps...my method is a little flawed before anyone points it out - as the bookmark property actually returns a double within a variant.
However with current versions of ADO, the value of the double is always integer, so I can use the itemdata property
<fingers crossed that this doesn't change in later versions...>
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6951527
to nutwiss :
if it's a disconnected recordset you can store AbsolutePos.

p.s. you should not sort or filter your recodset after ...  
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 6951566
nutwiss,  no need to worry, as THERE WILL BE NO LATER VERSIONS of VB... VB has been replaced by VB.NET, which allows the ItemData property to hold a OBJECT reference, so you can use almost ANYTHING you desire.  


Arthur Wood
0
 
LVL 4

Expert Comment

by:nutwiss
ID: 6951614
Yes, Arthur, i know - I meant any later versions of ADO :)
and rkot - I usually do filter or sort, that's why I use the bookmark...

Merlin, hope these suggestions help.
0
 

Author Comment

by:merlin007
ID: 6951807
Thanks everyone

This was a great help

Merlin007
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 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