Solved

RDO/RDC AND COMBO BOXES

Posted on 1998-06-22
3
309 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

896 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

14 Experts available now in Live!

Get 1:1 Help Now