hi folks,
I am trying to implement the four buttons(FIRST, PREVIOUS, NEXT, LAST) through which the person can browse through all the records in the recordset..
But some error that this function is not allowed is given by the VB.
I am giving you the code for it.......
Dim rsall As New ADODB.Recordset
Set rsall = conn.Execute("select * from patient where patient_no like '" & pandetails1 & "' order by patient_no"
If Not rsall.EOF Then
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End If
now the coding in the four buttons....
----FIRST
Private Sub cmdfirst_Click()
rsall.MoveFirst
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
----LAST(WHICH IS NOT WORKING)
Private Sub cmdlast_Click()
rsall.MoveLast
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
----PREVIOUS (WHICH IS NOT WORKING)
Private Sub cmdprevious_Click()
If Not rsall.BOF Then
rsall.MovePrevious
If rsall.BOF Then
MsgBox "First Record is Already Displayed"
End If
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
---NEXT
Private Sub cmdNext_Click()
If Not rsall.EOF Then
rsall.MoveNext
If rsall.EOF Then
MsgBox "No Furthur Records"
GoTo leave
End If
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
Please help me out to work this out..
I am trying to implement the four buttons(FIRST, PREVIOUS, NEXT, LAST) through which the person can browse through all the records in the recordset..
But some error that this function is not allowed is given by the VB.
I am giving you the code for it.......
Dim rsall As New ADODB.Recordset
Set rsall = conn.Execute("select * from patient where patient_no like '" & pandetails1 & "' order by patient_no"
If Not rsall.EOF Then
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End If
now the coding in the four buttons....
----FIRST
Private Sub cmdfirst_Click()
rsall.MoveFirst
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
----LAST(WHICH IS NOT WORKING)
Private Sub cmdlast_Click()
rsall.MoveLast
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
----PREVIOUS (WHICH IS NOT WORKING)
Private Sub cmdprevious_Click()
If Not rsall.BOF Then
rsall.MovePrevious
If rsall.BOF Then
MsgBox "First Record is Already Displayed"
End If
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
---NEXT
Private Sub cmdNext_Click()
If Not rsall.EOF Then
rsall.MoveNext
If rsall.EOF Then
MsgBox "No Furthur Records"
GoTo leave
End If
txtpatientnumber1.Text = rsall!patient_no
txtpatientname1.Text = rsall!patient_name
txtsex1.Text = rsall!sex
txtdateofbirth1.Text = rsall!dateofbirth
End Sub
Please help me out to work this out..