🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #4043

Re: HOWTO: use RowSource property of a field in MS Access table

#4043
From: Programmer Dude
Date: Mon, 15 Sep 2003 20:05
28 lines
2371 bytes
Vladimir wrote:

> Row Source = "1; "Above"; 2; "Below"; 3; "Equal"".
> When I try to SELECT <field> FROM <table> in my C++ application
> through ADO, I get numeric value of the field. How can I get
> string representation of this numeric value from the Row Source
> property?

You don't.  It doesn't exist in the table, ONLY in the Access Form
(specifically, in the ComboBox).  I assume the BoundColumn prop is
set to 1.  That means that when a user selects an item from the CB,
the first column's value is put in the database field.  The second
column values (the strings) never leave the CB.

You have two choices:

Ideal: create a new table containing the CB Row Source values, and
use that to populate the CB.  When you open a recordset, open an
SQL query that joins the main table to the new table and select
the field containing the strings.

Workable: Re-create the Row Source data in your C++ application
and translate from the numeric value to the string.

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|
Technical Details
Message-ID: <3F661B99.F254B2B5@mmm.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!msc1.onvoy!onvoy.com!news.mmm.com!not-for-mail
References: <1063654572.733837@ufacom.ru>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108717,5c969b162d5156fa
X-Google-Attributes: gid108717,public
X-Google-Thread: fcea4,5c969b162d5156fa
X-Google-Attributes: gidfcea4,public
X-Google-Thread: ff0ac,5c969b162d5156fa
X-Google-Attributes: gidff0ac,public
X-Google-Thread: 113dfb,5c969b162d5156fa
X-Google-Attributes: gid113dfb,public
X-Google-ArrivalTime: 2003-09-15 13:30:20 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!msc1.onvoy!onvoy.com!news.mmm.com!not-for-mail
From: Programmer Dude <cjsonnack@mmm.com>
Newsgroups: be.comp.programming,comp.databases.ms-access,comp.os.ms-windows.programmer.win32,comp.programming
Subject: Re: HOWTO: use RowSource property of a field in MS Access table
Date: Mon, 15 Sep 2003 15:05:45 -0500
Organization: Wrenn Productions, Ltd
Lines: 28
Message-ID: <3F661B99.F254B2B5@mmm.com>
References: <1063654572.733837@ufacom.ru>
NNTP-Posting-Host: 169.10.179.242
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en