Click to See Complete Forum and Search --> : First record of a query...
Samuel
Oct 19th, 2000, 04:22 AM
Hi,
i would like to extract the first record of a data base (in Oracle, or access or sql server) with a query in visual baic 6, but i don't want use counter or similar. How can i do?
thanks in advance
Rob Brown
Oct 19th, 2000, 06:58 AM
Try this:
Dim dbsDatabase as Database
Dim rstRecordset as Recordset
Set dbsDatabase = OpenDatabase "Full Path Here", False
Set rstRecordset = "Select Query Here"
rstRecordset.MoveFirst
That should place you in the first record of your recordset.
If you want to extract individual fields then just use something like this:
Dim strField0 as string
strField0 = rstRecordset(0)
0 is the first column in the recordset, if you want other columns then just substitute 0 for 1 and so on.
Hope this helps.
Best regards,
Rob Brown.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.