Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: multi-column list bound to a disconnected recordset?


Message #1 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 29 Aug 2001 12:19:08 -0700
I am not sure you can bind to a disconnected recordset (correct me if I
am wrong).  I think you would have to loop through the recorset and load
the combobox or ListBox.

	-----Original Message-----
	From: Pardee, Roy E
	Sent: Wed 8/29/2001 3:19 PM
	To: professional vb
	Cc:
	Subject: [pro_vb] multi-column list bound to a disconnected
recordset?
=09
=09

	Greetings all,
=09
	Apologies if this is too simple a question.  How do I bind a
disconnected
	recordset to a list or combo box?  I'm defining a client-side
recordset in
	code behind the form and want to use it as the recordsource of a
list box.
	I've tried both the ListBox and the DBList controls (the code is
below if
	you're interested), with their .DataSource and .DataField
properties, but in
	both cases I get empty lists.  Can anybody tell me what I'm
doing wrong
	here?
=09
	Thanks!
=09
	-Roy
=09
	Here is the code:
=09
	Private Sub Form_Load()
=09
	Set cn =3D New ADODB.Connection
	    
	      With cn
	         .ConnectionString =3D "Provider=3DMSDAORA.1;" & _
	               "Data Source=3DMMSPac;" & _
	               "User ID=3DRPardee;" & _
	               "Password=3D******;"
	         .Open
	      End With
=09
	      Set rs =3D New ADODB.Recordset
	      With rs
	         .CursorLocation =3D adUseClient
	         .LockType =3D adLockBatchOptimistic
	         .CursorType =3D adOpenStatic
	         Set .ActiveConnection =3D cn
	         .Source =3D "SELECT Cust_Customer As CustomerNumber,
	RTrim(CUST_CUSTOMER) || ' (' || RTrim(Cust_Name) || ')' AS BUBBA
FROM
	OMET.CUSTOMER "
	         .Open Options:=3DadCmdText
	         Set .ActiveConnection =3D Nothing
	      End With
	 
	      ' With Me.List1
	      With Me.DBList1
	         Set .DataSource =3D rs
	         .DataField =3D "CustomerNumber"
	         .Refresh
	      End With
	 
	End Sub
=09
yehuda@i...
$subst('Email.Unsub')
=09
=09


  Return to Index