Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / September 2007

Tip: Looking for answers? Try searching our database.

Object exists...and it doesn't

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FP1 - 11 Sep 2007 16:15 GMT
Some kind of zen thing in Access, maybe?  I'm calling a procedure with an
optional paramter.  I'm NOT passing that parameter in the calling procedure
and therefore the object should be "missing".  Access returns False from
IsMissing, IsEmpty and IsNull, and of course I then get "object or with
variable not set" when I try to access it. Any ideas?

Sub check_for_records_added(oldDB As ADODB.Connection, newDB As
ADODB.Connection, updatedTable, outOfDateTable, keyfields As Collection,
Optional outkeyfields As Collection)

Dim outkeys As Collection

'irrelevant stuff snipped

  If (IsMissing(outkeyfields) or Isnull(outkeyfields))  Then
    Set outkeys = keyfields
  Else
    Set outkeys = outkeyfields   '<--always true
  End If

Signature

Posted via a free Usenet account from http://www.teranews.com

Klatuu - 11 Sep 2007 18:20 GMT
The IsMissing only works with Variant data types. It will not work with an
object variable.
Signature

Dave Hargis, Microsoft Access MVP

> Some kind of zen thing in Access, maybe?  I'm calling a procedure with an
> optional paramter.  I'm NOT passing that parameter in the calling procedure
[quoted text clipped - 15 lines]
>      Set outkeys = outkeyfields   '<--always true
>    End If
FP1 - 11 Sep 2007 19:13 GMT
> The IsMissing only works with Variant data types. It will not work
> with an object variable.

Ouch!  Thanks.  So how would I check it? Isnull and Isempty return false.  
Would I use "is Nothing"?

Signature

Posted via a free Usenet account from http://www.teranews.com

Klatuu - 11 Sep 2007 21:02 GMT
What is outkeyfields and keyfields?

Signature

Dave Hargis, Microsoft Access MVP

> > The IsMissing only works with Variant data types. It will not work
> > with an object variable.
>
> Ouch!  Thanks.  So how would I check it? Isnull and Isempty return false.  
> Would I use "is Nothing"?
FP1 - 11 Sep 2007 20:33 GMT
> What is outkeyfields and keyfields?

Both user-defined class objects.

Signature

Posted via a free Usenet account from http://www.teranews.com

Klatuu - 11 Sep 2007 21:40 GMT
If they are class objects, I don't think passing them as collections is
correct.
It isn't clear to me what these objects contain or what it is you are trying
to do.
Maybe a description of the intent would be helpful.
Signature

Dave Hargis, Microsoft Access MVP

> > What is outkeyfields and keyfields?
>
> Both user-defined class objects.
FP1 - 11 Sep 2007 20:57 GMT
> If they are class objects, I don't think passing them as collections
> is correct.
> It isn't clear to me what these objects contain or what it is you are
> trying to do.
> Maybe a description of the intent would be helpful.

Actually, they are collections.  It's pretty simple, really. I'm building a
comparision of two tables in different database with potentially
differently primary keys (same basic keys, but could have differnt names).  
If they're different, I pass the secod set names, but if not, just copy the
first set.

Probably the best answer was the first one, that I can't check for a
missing object if it's not a variant.  Been coding access for over three
years and I still run into this stuff!

Signature

Posted via a free Usenet account from http://www.teranews.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.