Solved

MS ACCESS 2010 Return Table Created Date to Form Test Box

Posted on 2013-06-26
2
653 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

15 Experts available now in Live!

Get 1:1 Help Now