|
-
Feb 25th, 2000, 12:52 AM
#1
Thread Starter
Member
I need to pull the first 100 records from a database table in Access using VB. I know this is simple, but for some reason it is giving me fits.
Any suggestions?
Thanks!
-
Feb 25th, 2000, 12:58 AM
#2
New Member
You might want to try opening the table using dbOpenTable instead of dbOpenSnapShot. Sometimes SnapShot gives me a recordcount of 1, when there are over 10,000 records. 
Set db1 = dBEngine.Workspaces(0).OpenDatabase("W:\DB\info.mdb")
Set table_proj = db1.OpenRecordset("proj", dbOpenTable)
-
Feb 25th, 2000, 01:09 AM
#3
Thread Starter
Member
Thanks for the help, but I don't think I was clear enough (my fault).
I don't need a count, I need to pull the first 100 records from the database table, and export them to a text file.
Can you help?
Thanks!
-
Feb 25th, 2000, 02:46 AM
#4
Lively Member
Obtaining the first 100 records
You can use for example
Data1.Recordsource = " SELECT TOP 100 WHERE FirstName = " + "'" + "Rafael" + "'" + " ORDER BY Age "
-
Feb 25th, 2000, 09:09 AM
#5
New Member
Set db1 = dBEngine.Workspaces(0).OpenDatabase("W:\DB\info.mdb")
Set table_proj = db1.OpenRecordset("proj", dbOpenTable)
if table_proj.recordcount > 0 then
table_proj.movefirst
for i = 1 to 100
'do your fetching of information here
txtname.txt = table_proj("Name")
next
endif
-=-=-=
Hope the above works :P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|