Solved

MS ACCESS 2010 Return Table Created Date to Form Test Box

Posted on 2013-06-26
2
690 Views
Last Modified: 2013-06-26
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
Comment
Question by:REIHELPDESK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
als315 earned 200 total points
ID: 39280285
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
 
LVL 21
ID: 39280290
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question