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
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
Comment