Reputation: 1989
Hey guys, just want to ask you a simple question that I know you're familiar with... I am using VB6, I just want to get sets of records from my database. What I mean is that I have UserID and with a part of code provided below, it only gets a single set of record. Like for instance, the value of UserID is A12
, and so, all sets of records with the UserID of A12
must display in Textboxes respectively with the aid of datPayroll.Recordset.MoveNext
.
With datPayroll
.RecordSource = "select * from tblpayroll where empid like '" & UserID & "'"
.Refresh
Me.txtRegularHours.Text = .Recordset.Fields!reghours
End With
-datPayroll : DataControl
-txtRegularHours : Textbox
-UserID : Variable
Upvotes: 1
Views: 780
Reputation: 27342
You probably want to look at MoveFirst, MoveNext, etc. and also EOF
Here is a link or two to get you started:
You need to check that you have some data in your Recordset using EOF, then MoveFirst to move to the first record, and loop through using MoveNext.
Upvotes: 1