Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RDO/RDC AND COMBO BOXES

Posted on 1998-06-22
3
Medium Priority
?
316 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 200 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

Technology Partners: 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!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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

824 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