Movenext Events

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • piolo0879
    New Member
    • Aug 2006
    • 1

    Movenext Events

    hi good afternoon

    I have a problem i used a table in SQL. I already display the information to txtbox coming from table. My problem was i want to display the next record when we click the next botton.

    I hope you can help me as soon as possible. this is my codes.

    Private Sub cmdnext_Click()
    Dim cnn1 As ADODB.Connectio n
    Dim rstinvoice As Recordset
    Set cnn1 = New ADODB.Connectio n
    Dim strCnn, i, N As String
    Set rstinvoice = New Recordset

    rstinvoice.Open

    While Not rstinvoice.EOF
    rstinvoice.Move Next
    Wend

    End Sub

    Private Sub txtinvoice_Chan ge()
    Dim cnn1 As ADODB.Connectio n
    Dim strCnn As String
    Dim rstinvoice As Recordset


    Set cnn1 = New ADODB.Connectio n
    strCnn = "Provider=sqlol edb;" & _
    "Data Source=SWMSSQL; Initial Catalog=SWMS-2;User Id=sa;Password= 123;"
    cnn1.Open strCnn

    Set rstinvoice = New ADODB.Recordset

    rstinvoice.Curs orLocation = adUseClient

    rstinvoice.Open "select * from invoice WHERE invoiceno = '" & txtinvoice.Text & "'", cnn1, adOpenKeyset, adLockOptimisti c, adCmdText

    If rstinvoice.Reco rdCount < 1 Then
    Else
    txtisn.Text = rstinvoice!ISN
    txtorderno.Text = rstinvoice!orde rno
    txtpartno.Text = rstinvoice!part id
    txtpartname.Tex t = rstinvoice!part name
    txtinvqty.Text = rstinvoice!invq ty
    txtrcvqty.Text = rstinvoice!rcvq ty
    txtppq.Text = rstinvoice!ppq
    txtpackstart.Te xt = rstinvoice!Pack NoStart
    txtpackend.Text = rstinvoice!Pack NoEnd
    txtpackinv.Text = rstinvoice!pack invcount
    txtpackrcv.Text = rstinvoice!pack rcvcount
    txtdndate.Text = rstinvoice!dnlo addate
    txtrcvdate.Text = rstinvoice!rcvd ate
    txtshipment.Tex t = rstinvoice!ship mentno
    txtcontainer.Te xt = rstinvoice!cont ainerno
    txteta.Text = IIf(IsNull(rsti nvoice!etamanil a), "", rstinvoice!etam anila)
    txtetafac.Text = IIf(IsNull(rsti nvoice!etafacto ry), "", rstinvoice!etaf actory)
    End If
    End Sub
  • Reena83
    New Member
    • Sep 2006
    • 32

    #2
    Originally posted by piolo0879
    hi good afternoon

    I have a problem i used a table in SQL. I already display the information to txtbox coming from table. My problem was i want to display the next record when we click the next botton.

    I hope you can help me as soon as possible. this is my codes.

    Private Sub cmdnext_Click()
    Dim cnn1 As ADODB.Connectio n
    Dim rstinvoice As Recordset
    Set cnn1 = New ADODB.Connectio n
    Dim strCnn, i, N As String
    Set rstinvoice = New Recordset

    rstinvoice.Open

    While Not rstinvoice.EOF
    rstinvoice.Move Next
    Wend

    End Sub

    Private Sub txtinvoice_Chan ge()
    Dim cnn1 As ADODB.Connectio n
    Dim strCnn As String
    Dim rstinvoice As Recordset


    Set cnn1 = New ADODB.Connectio n
    strCnn = "Provider=sqlol edb;" & _
    "Data Source=SWMSSQL; Initial Catalog=SWMS-2;User Id=sa;Password= 123;"
    cnn1.Open strCnn

    Set rstinvoice = New ADODB.Recordset

    rstinvoice.Curs orLocation = adUseClient

    rstinvoice.Open "select * from invoice WHERE invoiceno = '" & txtinvoice.Text & "'", cnn1, adOpenKeyset, adLockOptimisti c, adCmdText

    If rstinvoice.Reco rdCount < 1 Then
    Else
    txtisn.Text = rstinvoice!ISN
    txtorderno.Text = rstinvoice!orde rno
    txtpartno.Text = rstinvoice!part id
    txtpartname.Tex t = rstinvoice!part name
    txtinvqty.Text = rstinvoice!invq ty
    txtrcvqty.Text = rstinvoice!rcvq ty
    txtppq.Text = rstinvoice!ppq
    txtpackstart.Te xt = rstinvoice!Pack NoStart
    txtpackend.Text = rstinvoice!Pack NoEnd
    txtpackinv.Text = rstinvoice!pack invcount
    txtpackrcv.Text = rstinvoice!pack rcvcount
    txtdndate.Text = rstinvoice!dnlo addate
    txtrcvdate.Text = rstinvoice!rcvd ate
    txtshipment.Tex t = rstinvoice!ship mentno
    txtcontainer.Te xt = rstinvoice!cont ainerno
    txteta.Text = IIf(IsNull(rsti nvoice!etamanil a), "", rstinvoice!etam anila)
    txtetafac.Text = IIf(IsNull(rsti nvoice!etafacto ry), "", rstinvoice!etaf actory)
    End If
    End Sub




    Hope this helps:

    Private Sub cmdNext_Click()
    'goto the next record
    rstInvoices.Mov eNext
    If rstInvoices.EOF Then
    MsgBox ("At the last record")
    rstInvoices.Mov eLast

    End If

    'display the record details
    Call showData
    End Sub

    Comment

    • jpezhil
      New Member
      • Sep 2006
      • 9

      #3
      Private Sub cmdNext_Click()

      ''First If U Find Record Set is End Of line After If U Use Move Next Command

      If rstInvoices.EOF Then
      MsgBox ("At the last record")
      rstInvoices.Mov eLast
      exit sub
      End If
      rstInvoices.Mov eNext
      'display the record details
      Call showData
      End Sub
      Thanking U(For U'r Reply)

      Comment

      Working...