Solved

RDO/RDC AND COMBO BOXES

Posted on 1998-06-22
3
308 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
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now