Is it possible to test to see if an object is not set or set to nothing. I'm attempting to use code to set a report's record source to a global recordset's name property but if the report was simply started normally the report craps out because the object isn't set. My thinking is if it is possible I can use an if then to set the reports recordsource to a different query. The only way I thought of was using an error handler to catch the error condition and handle it that way. Any help would be great. Thanks.
What I've got going is this. I'm declaring a recordset in code and giving the user an option to print a report based on the records in it. (I'm also doing some other stuff with it as well) The recordset I'm using for that is declared public in the module. When the user decides to print the report the onOpen event for the report grabs the recordsets name and uses it for the record source. My problem is this - I want to make that report available in other instances when that pulbic recordset is not in scope or hasn't been set through code. So I need to test whether or not the recordset is set to anything before I grab its name and use it as the recordsource behind the report. I managed with an error catcher but what I'm wondering is there a way to test that recordset object to discover if it is set to anything before going ahead. Thanks.
I'm curious as to how your user is defining your recordset to begin with.. and more importantly, what the difference between the recordsets would be if the user launches your report using your "coded" recordset, vs. opening the report from elsewhere in the application..
Is there some filters/etc that would be removed?
This is what I"m trying to drive at, if the recordsource doesn't change to dramatically, perhaps you could build the recordsource in the report instead of in your module, then this same recordsource would be available no matter where it's called from.
You could then alter parameters (possibly as variables) from wherever your users are currently defining your recordset..
I hope that was clear enough for you to get my idea..