We help IT Professionals succeed at work.

Empty Recordset

soeding1
soeding1 asked
on
208 Views
Last Modified: 2010-05-03
Code Example:
...
sq = "SELECT * FROM..."
Set rec = ...
X = rec!SomeThing

Problem:
If no "SomeThing" is found in the database or "SomeThing" is "empty", there will be an error.

Workaround:
On Error Resume next
...
recTest = ""
recTest = rec!SomeThing
If recTest <> "" Then ...

Solution:
What is the "value" of rec!SomeThing, if SomeThing is not found or empty?
Comment
Watch Question

prog
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
deightonprog

Commented:
To clarify my answer

If the recordset is empty then you cant' access the field value without error.  You check for this with rec.RecordCount = 0 (indicates empty record set)


Author

Commented:
deighton,
of course...
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.