Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 707
  • Last Modified:

MS ACCESS 2010 Return Table Created Date to Form Test Box

Looking to get the Microsoft Access 2010 table created date/time to show up on a form in a textbox or label (don't which is best).

Objective
Display the Created Date for a table, "tmp_New_Items", on a form, "frm_New_Items", in a Textbox or Label.  

Steps Taken:

1.      Wrote the following function that works, now I need to get the results pushed to my form.

Public Function GetTableCreateDate(CreatedDate)

    CreateDate = CurrentDb.TableDefs("tmp_New_ITEMS").Properties("DateCreated")
    MsgBox CreateDate
     
End Function
2.      Added Text Box to form and updated the Control Source to “GetTableCreateDate(CreatedDate)”
3.      The Msgbox works… heee (We will remark that once working)
4.      Do I need to setup and run a Macro? (I’m not familiar with how)

Background:
When New Products are Ready to be imported we conduct a Make Table Query that creates the tmp_New_Items table with no problems.
0
REIHELPDESK
Asked:
REIHELPDESK
1 Solution
 
als315Commented:
Look at sample. Your function should be liitle bit different:
Public Function GetTableCreateDate() As Date

    GetTableCreateDate = CurrentDb.TableDefs("tmp_New_ITEMS").Properties("DateCreated")
     
End Function

Open in new window

DBtblDate.accdb
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
You can  update your function to return the date  like this:
Public Function GetTableCreateDate(pTableName as String) as Date

    GetTableCreateDate= CurrentDb.TableDefs(pTableName).Properties("DateCreated")
        
End Function

Open in new window

Example usage in immediate window:
 ? GetTableCreateDate("tmp_New_ITEMS")

Open in new window


Set the control soucre to: =GetTableCreateDate("tmp_New_ITEMS")

Now the function can be used with any table by passing the table name to the function and it will return the Date Created.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now