Solved

RDO/RDC AND COMBO BOXES

Posted on 1998-06-22
3
312 Views
Last Modified: 2010-05-03
How do I get a list for the combo box when using rdo/rdc. When the form is loaded so that when the user uses the combo box they have their list of selections to use from a reference table?
0
Comment
Question by:MaryD
[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
3 Comments
 
LVL 4

Expert Comment

by:yowkee
ID: 1464001
MaryD,

  Sorry, don't really know what you want. Are you going to use RDO to fetch data from remote database and then list out the fetched data to combo box?


0
 

Author Comment

by:MaryD
ID: 1464002
Yes thats what I would like to do. The tables are on the server and I need to retrieve that information and load a combo box. I will also have multiple tables to pull from in some cases.

Thanks
0
 
LVL 4

Accepted Solution

by:
trkcorp earned 50 total points
ID: 1464003
With RDC:
MSRDC#:Code your CONNECT string and SQL on the RDC.
DBCOMBO#: Set the ROWSOURCE = MSRDC# and the LISTFIELD = FieldName.  This is the minimum to get a list. To tie the selection to anything use DATASOURCE, DATAFIELD & BOUNDCOLUMN.
BOUNDCOLUMN allows you to retrieve the bound column value via the BOUNDTEXT property in code. DATASOURCE and DATAFIELD will bind your result or initialization to another control.
With RDO:
Basically the same thing only you have to code the whole thing and read the resultset palcing your items in a combo box with the ADDITEM method. For Example (SQL SERVER):

Dim Env As rdoEnvironment
Dim Cn As rdoConnection
Dim rs As rdoResultset
Dim i As Integer

Set Env = rdoEnvironments(0)
Set Cn = Env.OpenConnection("", rdDriverNoPrompt, True, "UID=;PASSWORD=;DSN=YOURDSN;DATABASE=YOURDB")
Set rs = Cn.OpenResultset("Select * from YOURTABLE")
' yes the first record is already available w/out a movefirst...
i = 0
Do While Not rs.EOF
  Combo1.AddItem rs.rdoColumns(0), i
  i = i + 1
  rs.MoveNext
Loop

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Spell Check in VB6 13 152
Set email body to html using vbscript 6 98
Automatic Email Reminder 4 94
Publisher:   Unknown     VB.exe Application 1 32
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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

710 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