Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424


    but not for those defined as Object.
    Not sure if you ever got the answer to that or not. I'd say that when you declare a variable of type Object you are late binding. Access has no idea what kind of object that will be, thus you don't get intellisense. IIRC, you never get intellisense when late binding like that.

    As for which library a Property, Object or Method (POM) might belong to, I would not rely on the first in the order of references. As you have discovered, invoking the library (usually by its common name) before the POM is the way to go. Perhaps you have seen this before as in DAO.Recordset vs ADO.Recordset, which is the better form so as to remove disambiguation. Sometimes this is done in the declaration itself, as in Dim fso As New Scripting.FileSystemObject
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    @Miles R
    Re: FATT - I also originally referred to file attributes when I first developed my app about 7 years ago.
    However, the approved terminology appears to be standard file properties (for those common to all Windows files (e.g. name/date created/date modified etc) and extended file properties for those that depend on file type.
    In total there are 321 of these properties though no individual file type has more than 50 or so of these properties

    If you haven't yet done so, I would recommend you look at my example app. It might save you some time/work
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #18
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    280
    Thanks for the reply. I have just come to terms with Early and Late binding and am now using Early Binding for all variables that were declared as Object. Now using the correct Class Name after adding the appropriate library.
    I only found Shell32.Folder by looking at other code as it was not obvious from the Library Browser in the Visual Basic Editor. Now I see that if I enter Folder in the search box, I get a load of lines that contain the word Folder and Shell32 library is one of them.
    Scripting.Folder would be the full name for the other Folder class that I use.

    What puzzles me slightly is how the code works if the Library is not included. Prior to changing to Shell32.Folder, the variable was declared as Object and the Library "Microsoft Shell Controls and Automation" was not included. The code still worked, but without Intellisense obviously.

  4. #19
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    Late binding doesn't require the library to work as you create a non-specific object, then assign something to it. That is why there in no Intellisense - no library associated with it.
    Early binding requires the library and therefore it knows the scope and related object references.

    Late Binding will work everywhere on other machines.
    Early Binding won't if the machine doesn't have the same version of the same library loaded.

    For apps that you intend to send to other users, develop using early binding but change to late binding once it is ready to distribute, to avoid issues with references.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #20
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    280
    Minty,

    Thanks for the reply. I will use Early Binding as all the code is for my use only.
    I'm still not getting it though. For the code to work on other machines, they have to have the code. If the library is not included, where does the code come from?
    If the code is not in the library what does the library do? Is the library just a reference for what is in the code - which hopefully would have to match otherwise it could go wrong.

  6. #21
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    There is a much more enlightened explanation here:
    https://www.devhut.net/vba-early-bin...-late-binding/

    With part two here:
    https://www.devhut.net/vba-early-bin...inding-part-2/

    Hopefully that will answer all your questions, if not come back and ask.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #22
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    280
    Minty,

    Ok thanks that makes it a bit clearer. So the code itself must be part of the Access installation itself and not in any library.
    I guess for me the only issue will be when I migrate to 64-bit Office 365 on Windows 11, will the library references need updating. I'll worry about that when it happens though.

  8. #23
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    So the code itself must be part of the Access installation itself and not in any library.
    Don't think you quite have it yet. Libraries may or may not be part of an Access install. Could be part of Office install as well. Usually with any given version of Office/Windows/Access every typical install puts the required files in the same place. These file extensions are like .tlb, .ocx, and mostly .dll

    As long as those file locations are the same for all users, things should work for the most part because these libraries you speak of are those files. When you create a reference, you are adding references to these files and not the files themselves. If the reference you add points to a file that is in a different location (e.g. you're on W10 and user is on XP) that is likely a big enough difference in Windows versions (thus likely Office as well) so it's unlikely these files exist in the XP user's pc in the same place, if at all.

    I said for the most part because the only reason you'd ever have to worry about 64 bit vs 32 bit when it comes to vba is if you use API functions that use pointers that need to be declared as safe. I'm no expert on that subject but that's how I understand it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #24
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    280
    Thanks Micron,

    Ok I think I'm getting there. So, in this case the code (specifically getDetailsOf) is part of Shell32.dll. If I add the Library reference, I can use the correct Class name from the library (Shell32.Folder) and Intellisense.
    Presumably, if the Library Reference is not included, the runtime has to find getDetailsOf from somewhere. Not sure how it knows to look in Shell32 though - no doubt in the internals of the system somewhere.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. IntelliSense (SQL Server Management Studio)
    By adnancanada in forum Queries
    Replies: 0
    Last Post: 08-04-2016, 11:42 PM
  2. Add more Intellisense to UDF in access
    By Perceptus in forum Programming
    Replies: 6
    Last Post: 09-17-2015, 03:12 PM
  3. Login Form and VBA scripting
    By data808 in forum Security
    Replies: 4
    Last Post: 02-27-2013, 12:01 AM
  4. Connect via ODBC and vb scripting or php
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-28-2010, 08:41 PM
  5. intellisense not behaving
    By avianrand in forum Programming
    Replies: 3
    Last Post: 06-18-2010, 04:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums