RDO/RDC AND COMBO BOXES

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?
MaryDAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
trkcorpConnect With a Mentor Commented:
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
 
yowkeeCommented:
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
 
MaryDAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.