list box help... this is an emergency

databases , db Turkey
  • 12 years ago

     

    i have a question and would really appreciate any insights. heres the deal- i have two listboxes, one i have populated with a column from my access database. i have a command button that allows the user to move their selections to the other empty listbox. here is my question: is it possible to use an sql query to produce a view of the table for a report based on the selections in the list box? it seems to me, that it would involve an array and a loop. i am just very confused and would appreciate any advice or help. thanks for your time.

     

    If optName.Value = True Then
    Dim strSQL As String
    strSQL = "SELECT * FROM Usages WHERE UsageID = " & List2.Text & ""
    Adodc1.RecordSource = strSQL

    Adodc1.Refresh

    I tried this - refresh causes an error in the from clause.  i tried setting the record source to amdunknown and that did not work

    :(
     

  • 12 years ago

    hi, very close

     Try

     Dim strSQL As String
     strSQL = "SELECT * FROM Usages WHERE UsageID = " & List2.Text & ""
     Adodc1.CommandType = adCmdText
     Adodc1.RecordSource = strSQL
     Adodc1.Refresh

    Ensure the strSQL is OK also ... UsageID is numeric by the looks of things

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry