Results 1 to 7 of 7
  1. #1
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25

    Access custom document property in vba


    On the document property window I created a custom variable named "DIRMOD".

    I'm trying to get the value in it in VBA, but I get a object required error using the following sintax:

    Dim als As String


    als = ActiveDocument.CustomDocumentProperties("DIRMOD"). Value

    What is the correct sintax to get a custom document property value?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You may get some insight from the Similar Threads at the bottom of this page.
    This Word info may be helpful

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25
    Hi, sorry I tried googling but for some reason I seem unable to make it work, this is my user property (DIRMOD):

    Click image for larger version. 

Name:	Cattura.PNG 
Views:	12 
Size:	13.9 KB 
ID:	51118

    If I use CurrentDb.Properties("DIRMOD") I get a property not found error


    If I use oCurrentDb.Properties("DIRMOD") I get runtime error 424 object required.

    Sorry but I can t figure out, any help appreciated

  5. #5
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25
    I can confirm that listing db.properies the custom ones are not in the list, for those interested here is the solution:


    ms access 2016 - get custom database properties in vba - Stack Overflow

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by cesarone82 View Post
    I can confirm that listing db.properies the custom ones are not in the list, for those interested here is the solution:


    ms access 2016 - get custom database properties in vba - Stack Overflow
    I have only played with properties once before, but that code works for me.
    However there was a glaring error with that code in that oCurrentDB was not defined and set?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    See this Create databaseproperty
    My guess is that you used Daniel Pineault's approach with oCurrentDB but have not Dimmed that object.

    Your earlier post sounded like you were working with a Word activedocument.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Custom Document Properties
    By tecknologika in forum Programming
    Replies: 2
    Last Post: 08-22-2017, 11:57 AM
  2. Replies: 5
    Last Post: 01-23-2014, 09:36 AM
  3. Design Issue: Custom Property?
    By Stan Denman in forum Database Design
    Replies: 2
    Last Post: 03-30-2012, 11:11 AM
  4. Setting Custom Field Format Property Problem
    By Weelmaa in forum Programming
    Replies: 2
    Last Post: 02-25-2012, 05:33 AM
  5. Over My Head: Custom Recordset Property
    By Drawn in forum Programming
    Replies: 1
    Last Post: 03-25-2011, 05:39 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