Does anyone know of a tutorial/site that explains how to bind to a tdblist clearly? If anyone could explain it, I would also appreciate it.

So far I have this and must be missing something. It has been way too long since I have done anything in VB6. :)

Other than tdbList.ReBind I cannot think of what does it. I have everything bound from the properties side too. I think anyway.

BTW I am linking up to a SQL DB...

Recommended Answers

All 3 Replies

Hi,

I guess, you want the code for "DataList" box control..:
add a "DataList" control on the form and set these Properties..:

RowSource = ADODC1
ListField ="MyFieldName"
BoundColumn = "MyFieldName"

if you dont have ADODC,
then @ runtime, you can open a recordset and set rowsource to that ADOrecordset

Regards
Veena

Hi,

I guess, you want the code for "DataList" box control..:
add a "DataList" control on the form and set these Properties..:

RowSource = ADODC1
ListField ="MyFieldName"
BoundColumn = "MyFieldName"

if you dont have ADODC,
then @ runtime, you can open a recordset and set rowsource to that ADOrecordset

Regards
Veena

I tried only that and it did not work out for me... Here is what I have so far code wise that should populate the list. Hopefully something will stand out. Currently I am getting the headers, but none of the data.

Public Sub FormOpen(bModal As Boolean, bVisible As Boolean, CurrParentID As String, CurrLocationType As String, Optional fParentform As Form)
     'Set datDirs.Recordset = RunSP("REC", "s_FRCBL", "42330", "Shipper")
    sOrder = "Company"
    strFilter = "Company" 'sFilter
    
    
    Screen.MousePointer = vbHourglass
    DataRefresh strFilter, sOrder
    Screen.MousePointer = vbDefault
    
    StartingPointer = 0
    If Not StartingPointer = 0 Then
        'Pointer to Current Selection has been requested
        With datDirs.Recordset
            If .RecordCount > 0 Then
                .MoveFirst
                .Find "ID=" & StartingPointer
                If Not .EOF Then
                    TDBCust.Bookmark = .AbsolutePosition
                Else
                    'If not found in the list specified, look in the un-validated entries
                    DataRefresh strFilter, sOrder
                    If Not datDirs.Recordset.EOF Then
                        datDirs.Recordset.MoveFirst
                        .Find "ID=" & StartingPointer
                        'lstDirs.Bookmark = datDirs.RecordSet.AbsolutePosition
                    End If
                End If
            End If
        End With
     End If
   
    
   Me.Show Abs(bModal)
End Sub
Private Sub DataRefresh(CurrFilter As String, CurrOrder As String)
Dim x As Integer
Dim strCurrFilter As String

    strCurrFilter = UCase(CurrFilter)
    Screen.MousePointer = vbHourglass
    
    'Refresh List Message Opens
    'cmdLoading.Visible = True
    DoEvents
    Me.AutoRedraw = False
    
    Set datDirs.Recordset = RunSP("REC", "s_DirectoryListByRole", strCurrFilter, CurrOrder)
    
    TDBCust.ReBind
    
    DirectoryListFormat sOrder
    'lDirectoryId = TDBCust.Columns("ID")
    With datDirs.Recordset
        If Not lDirectoryId = 0 Then
            .Find "ID=" & lDirectoryId
            If .EOF Then
                If Not .BOF Then
                    .MoveFirst
                End If
                SendKeys "{Home}+{Down}"
            Else
                TDBCust.Bookmark = .AbsolutePosition
            End If
        Else
            If Not .BOF Then
                .MoveFirst
            End If
            
        End If
    End With
    DoEvents
    Screen.MousePointer = vbDefault
    Me.AutoRedraw = True
    'Me.Caption = strCurrFilter & " " & datDirs.Recordset.RecordCount

End Sub

Thanks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.