Solved

MS ACCESS 2010 Return Table Created Date to Form Test Box

Posted on 2013-06-26
2
662 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
2 Comments
 
LVL 39

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now