|
-
Nov 8th, 2000, 09:59 AM
#1
Thread Starter
Addicted Member
Sorry for this one, Some of you may laugh some of you may think what a Pratt.........But here it goes.
What commands (code) would I use to check if a recordset contains information. Don't need to know what it contains just if it contains something??
Thanks in advance
Regards,
Rocks
-
Nov 8th, 2000, 10:09 AM
#2
Frenzied Member
Check EOF on the recordset just after you open it. Just to be safe you could check for BOF AND EOF to both be true.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Nov 8th, 2000, 10:15 AM
#3
PowerPoster
rst.recordcount=0
Means no returned records
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 8th, 2000, 10:19 AM
#4
Thread Starter
Addicted Member
Let me re phrase
Thanks for your reply but after reading my own msg again, I would like to re-phrase it.
I have a recordset that is populated with various records from a DB.
It populates them one record at a time. What I would like to do is to check if a particular record is in the recordset just after the code to populate that recordset has been exe'd.
This is because I write each record to an individual file, what I do at the moment is create all the files before the SQL has run. Therefore that results in empty files if no info is contained in some records.
-
Nov 8th, 2000, 10:20 AM
#5
Fanatic Member
Be careful with RecordCount - it is not defined properly until all records have been traversed (rst.MoveLast or similar).
If rst.EOF and rst.BOF Then
MsgBox "Definitely no records"
Else
MsgBox "At least one record"
End If
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 8th, 2000, 10:24 AM
#6
PowerPoster
??
Will the all fields that are coming in have values? What I mean is, could you use a field to evaluate your situation?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 8th, 2000, 01:44 PM
#7
Hyperactive Member
Assuming you have a primary key, do a .Find (ADO) or .FindFirst (DAO) to find the value of the record you think you just added.
Better would be to set the .Index property of the recordset to "PrimaryKey" and use the .Seek method, cause it's much faster.
-
Nov 9th, 2000, 05:07 AM
#8
Thread Starter
Addicted Member
Thanks
Thanks all,
Maybe you would be able to help me out with another Q.
It is regarding Excel.
I need to lock the margins of the workbook so that they can not be changed in the print preview or page setup....
Thanks all.
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
|