VB6 Using DataControl
Hello guys, just want you to ask something about my code... I have 5 records n my database with the UserID of A02-0005
... I want to get it all using DataControl and display into TextBoxes respectively... My problem is I get only a single set of record and when I click the NextButton of DataControl, nothing happens. At the design time, I'd set the DatabaseName, RecourdSource, and RecordSetType of my DataControl... Where then the problem possibly occurs? I am using VB6... Thanks in开发者_StackOverflow advance.
The problem here is with the Seek method. The method takes another argument called SeekOption and by default it will just find the first match.
Instead you could use the Find method on the Recordset as follows. You need to specify your search criteria and also where in the recordset to begin searching from.
Data1.Recordset.Find Criteria:="idxid= 'A02-0005'", Start:=adBookmarkFirst
Finally if you want your text boxes to update automatically when the user clicks the data control then you can just set the DataSource & DataField properties of the text box controls at design time.
精彩评论