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 / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Assigning Address To A Variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eddie's Bakery and Cafe' - 19 Mar 2005 23:37 GMT
Hi, I am trying to assign a variable the address of a collection object.  I
want to use one several possible collections in an argument list.  When I try
to assign the variable the address of the collection I get a compile error,
“Argument not Optional”

Here a code sample:

Private Function foo (level As GetRecipeLevel, …) As Boolean
 
 Dim PKeyAddr As Collection
 
 With myCollectionList
   
   Select Case level
   
     Case MenuCategoryLevel
        PKeyAddr = .MenuCategory       ' Collection Object of Menu Category
Names
     
     Case RecipeTypeLevel
        PKeyAddr = .RecipeType           ' Collection Object of Recipe Type
Names
     
     Case RecipeCategoryLevel
        PKeyAddr = .RecipeCategory     ' Collection Object of Recipe
Category Names
     
     Case RecipeNameLevel
        PKeyAddr = .RecipenName        ' Collection Object of Recipe Names
   End Select
 End With
   
 Call GetPrimaryKey (PKeyAddr)
 
End Function

------

Thanks for you help, it is greatly appreciated, Eddie Eytchison
Alex Dybenko - 20 Mar 2005 10:48 GMT
You have to use Set with object variables:

Set PKeyAddr = .MenuCategory

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi, I am trying to assign a variable the address of a collection object.
> I
[quoted text clipped - 40 lines]
>
> Thanks for you help, it is greatly appreciated, Eddie Eytchison
Eddie's Bakery and Cafe' - 20 Mar 2005 14:48 GMT
Alex, thanks for the feedback

> You have to use Set with object variables:
>
[quoted text clipped - 44 lines]
> >
> > Thanks for you help, it is greatly appreciated, Eddie Eytchison
 
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.