G
Guest
Hi,
Als a beginner, I am looking for a way to show records
My code is
Private sub Connection(
Dim odbconn_Pro As OleDbConnectio
Dim odbcomm_Pro As OleDbComman
Dim odbdare_Pro As OleDbDataReade
Dim DataFile as Strin
DataFile = "H:\Production\Prod.mdb
odbconn_Pro = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& "DATA SOURCE=" & DataFile
odbcomm_Pro = New OleDbComman
odbcomm_Pro.CommandText = "SELECT * FROM Collection ORDER BY bt_code
odbcomm_Pro.Connection = odbconn_Pr
odbcomm_Pro.Connection.Open(
odbdare_Pro = odbcomm_Pro.ExecuteReade
If odbdare_Pro.HasRows The
ShowDetail(
End I
End Su
Private Sub ShowDetail(
While odbdare_Pro.Read(
lblCode.Text = odbdare_Pro("bt_code"
lblName.Text = odbdare_Pro("bt_Name"
....
....
End Whil
End Su
When this proram run. It show only the last record. I know why, because I use : While odbdare_Pro.Read()
So the program read all the records and shows the last one
What I want is the program just shows the first record
Meanwhile I have 4 toolbar Buttons : "First Record", "Previous", "Next" and "Last" to navigate which record to show
After the first record is showed, the user can click one of the 4 buttons.
If the "First Record" button is clicked, the first record will be showed
If the "Previous" button is clicked, the previous record of the shown record will be showed
If the "Next" button is clicked, the next record of the shown record will be showed
If the "Last" button is clicked, the last record will be showed
How can I do like this ? Please somebody help me
Thanks in advance
Joachim
Als a beginner, I am looking for a way to show records
My code is
Private sub Connection(
Dim odbconn_Pro As OleDbConnectio
Dim odbcomm_Pro As OleDbComman
Dim odbdare_Pro As OleDbDataReade
Dim DataFile as Strin
DataFile = "H:\Production\Prod.mdb
odbconn_Pro = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& "DATA SOURCE=" & DataFile
odbcomm_Pro = New OleDbComman
odbcomm_Pro.CommandText = "SELECT * FROM Collection ORDER BY bt_code
odbcomm_Pro.Connection = odbconn_Pr
odbcomm_Pro.Connection.Open(
odbdare_Pro = odbcomm_Pro.ExecuteReade
If odbdare_Pro.HasRows The
ShowDetail(
End I
End Su
Private Sub ShowDetail(
While odbdare_Pro.Read(
lblCode.Text = odbdare_Pro("bt_code"
lblName.Text = odbdare_Pro("bt_Name"
....
....
End Whil
End Su
When this proram run. It show only the last record. I know why, because I use : While odbdare_Pro.Read()
So the program read all the records and shows the last one
What I want is the program just shows the first record
Meanwhile I have 4 toolbar Buttons : "First Record", "Previous", "Next" and "Last" to navigate which record to show
After the first record is showed, the user can click one of the 4 buttons.
If the "First Record" button is clicked, the first record will be showed
If the "Previous" button is clicked, the previous record of the shown record will be showed
If the "Next" button is clicked, the next record of the shown record will be showed
If the "Last" button is clicked, the last record will be showed
How can I do like this ? Please somebody help me
Thanks in advance
Joachim