Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    Binary Universe
    Posts
    57

    Unanswered: List box question.

    code:

    List1.RowSource = "SELECT field1, field2 FROM table1, table2 WHERE table1.record_ID = table2.record_ID"

    question:

    Is there a way to display field1 on one line and field2 on the next:

    field1
    field2

    and not:

    field1 field2

    Thanks
    I won't byte... hard!

  2. #2
    Join Date
    Mar 2004
    Posts
    118
    Crosstab Queries. Make one with the wizard and copy the SQL.

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You could try:

    Code:
    Sub LoadList()
        Dim rs As Recordset
        Dim SQL As String
        Dim RowSource As String
    
    
        SQL = "SELECT field1, field2 FROM table1, table2 WHERE table1.record_ID = table2.record_ID"
    
        Set rs = CurrentDb.OpenRecordset(SQL)
        
        If rs.BOF And rs.EOF Then
            MsgBox "No records !!"
        Else
            RowSource = rs(0).Name
            For i = 1 To rs.Fields.Count - 1
                RowSource = RowSource & "; " & rs(i).Name
                rs.MoveLast
            Next i
            List1.RowSource = RowSource
        End If
        
    End Sub

    Merry Christmas !!

    MTB

Posting Permissions

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