Results 1 to 2 of 2

Thread: DBList Control?

  1. #1

    Thread Starter
    Addicted Member scotty85_2000's Avatar
    Join Date
    Feb 2001
    Posts
    198
    How do I display all true values from an access database boolean field in a DBListBox Control?
    (SQL Statement please if possible...)
    Thanks in advance...

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    I assume you mean show records that have a boolean field in, which is true...?

    Try this, it's a sample that includes the field CustomerID, CustomerName and IsBooyaka (the boolean)

    Dim MyDB As Connection
    MyDB = New Connection
    Dim adoMyAdo As Recordset
    Set adoMyAdo = New Recordset
    With MyDB
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\Mydb.mdb;Jet OLEDBatabase Password=mypassword;"
    .Open
    End With

    adoMyAdo.Open "SELECT Customers.CustomerID, Customers.CustomerName FROM Customers WHERE Customers.IsBooyaka = True ORDER BY Customers.CustomerID;", MyDB, adOpenStatic, adLockOptimistic

    Now set the properties of the Data List

    Set DataList1.RowSource = adoMyAdo
    DataList1.BoundColumn = "CustomerID"
    DataList1.ListField = "CustomerName"

    Listfield is the field you want shown in the listbox and bound column is the value returned by the listbox.

    If that don't work there is probably something really obvious I made a typo on or something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width