If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Applications & Tools > can not set ListField poperty of a DataCombo control

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-04, 02:48
oby1 oby1 is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Red face can not set ListField poperty of a DataCombo control

Hi,

I am trying to set the ListField property of a DataCombo Control to a subset of values like in the code below.
DataCombo2 should display in the ListField the "id" values that satisfy a certain condition (Where clause in the SQL statement) from the "id" column in the "Nadfmm" table.
...but it boesn't happen! the ListField is empty, WHY?
PLEASE HELP ME.
here is the code I have written so far:
=================================
Code:
Dim SQLString As String
Dim my_recordset As New ADODB.Recordset
Dim my_connection As New ADODB.Connection

Private Sub DataCombo1_Change()

SQLString = "SELECT Nadfmm.id FROM Nadfmm WHERE Nadfmm.board = """ & Me.DataCombo1 & """"

Set my_connection = New ADODB.Connection
my_connection.ConnectionString = "Provider =Microsoft.Jet.OLEDB.3.51;Data Source=C:\Documents and Settings\icgR225\My Documents\nadfmm97.mdb;"
my_connection.Open

With my_recordset
     .Source = SQLString
     .CursorType = adOpenDynamic
     .CursorLocation = adUseServer
     .LockType = adLockOptimistic
     .ActiveConnection = my_connection
     .Open , , , , adCmdText
End With

Set Me.DataCombo2.RowSource = my_recordset
Me.DataCombo2.ListField = "id"

my_recordset.Close
my_connection.Close

End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On