locked
Calling a table property RRS feed

  • Question

  • Is there any way that I can call a table property to view it? For example, I often update a table called "Cases", can I call the properties for cases and view the table's Name, Description, or Modified?  If so, please enlighten me.  I would like to show in a report the date a table was Modified without having to do it manually.
    Wednesday, June 7, 2017 12:19 PM

All replies

  • Hi,

    You could try the following lines:

    CurrentDb.TableDefs("Cases").DateCreated

    and

    CurrentDb.TableDefs("Cases").LastUpdated

    Hope it helps...

    Wednesday, June 7, 2017 2:41 PM
  • Adding on to .theDBGuy's response, if you want the table's Description property, that's not a default property of the TableDef, so you have to get it via the Prooperties collection, like this:

        CurrentDb.TableDefs("Cases").Properties("Description")

    BUT the property only exists if it has been set, and the above reference will raise an error if the property has never been set.  You would have to trap and ignore that error.


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Wednesday, June 7, 2017 4:31 PM
  • It sounds like he wants to simply report the date/time a record was added or changed. If that's the case, then:

    1. Add a field in the table called ModifiedDateTime (you should include a time because the same record may be modified on the same day at different times).
    2. Use the Data Type Date/Time and Format General Date
    3. Add the field to your forms Record Source query
    4. Add a textbox control called ModifiedDateTime on your form where records are added or changed and bind it to the ModifiedDateTime field.
    5. Format the textbox control as General Date
    6. Set its default value to: Now() (for new records added).
    7. When a user change occurs, use the following VBA code to enter the change date and time using the forms After Update Event:

           Me.ModifiedDateTime = Now 

    Wednesday, June 7, 2017 5:14 PM
  • Hi NoviceVBAuser1775,

    I can see that after creating this thread , you did not respond to this thread again.

    I can see that community members had provided the suggestions that can solve your issue.

    if your issue is solved now then try to post your solution and mark it as an answer so that we can close this thread.

    if your issue is still exist then try to refer the suggestions provided by the community members.

    if then also you have any questions then let us know about that.

    we will try to provide you further suggestions to solve your issue.

    Regards

    Deepak 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 28, 2017 8:58 AM