recordset movenext dont create textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • beceri
    New Member
    • Nov 2008
    • 5

    recordset movenext dont create textbox

    Hi I use this code ;

    Dim tumrecord As New ADODB.Recordset
    With tumrecord
    strrecord = [sql code OK ]
    .Open strrecord, CurrentProject. Connection, adOpenStatic
    If .RecordCount > 0 Then
    Do Until .EOF
    Me.txt1 = .Fields("Order_ Number")
    .MoveNext
    Loop
    End If
    .Close
    End With

    my Sql code is ok that is correctly and .recorcount find 26 items but
    txt1 take only see end data ; And I see only one record but I want this textbox must be 26 and see all data How can I do ;

    Thanks for read and imagine for me
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The following code, assuming your SQL Statement is correct, will append all 26 Order Numbers to a Text Box on the Current Form named txt1. They will be delimited by a semi-colon as in:
    Code:
    Order_Number1;Order_Number2;Order_Number3...Order_Number26
    Code:
    Dim tumrecord As New ADODB.Recordset
    Dim strAppend As String
    
    strrecord = [sql code OK ]
    
    With tumrecord
      .Open strrecord, CurrentProject.Connection, adOpenStatic
        If .RecordCount > 0 Then
          Do Until .EOF
            strAppend = strAppend & .Fields("Order_Number") & ";"
           .MoveNext
          Loop
        End If
    End With
    
    turnrecord.Close
    Set turnrecord = Nothing
    
    Me.txt1 = Left$(strAppend, Len(strAppend) - 1

    Comment

    • beceri
      New Member
      • Nov 2008
      • 5

      #3
      thanks for info I found normal record set and change sql nothing relations
      but this code is too important me thanks again

      Comment

      Working...