Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading a table into a report with a variable name.

Status
Not open for further replies.

TheClaw

Technical User
May 18, 2001
21
US
I have set a macro to run a query which creates a table then the macro renames it dpending on the date. I.e. ="tblAccountSummary" & "-" & Date().

This works fine but how do I then create a form using this name?? I obviously can put 'tblAccountSummary-24/05/01' in but I need to be able to have the date variable in there.

Hope you can understand this!

Does anyone know??

Thanks in advance.
Ben
 
I understand the table creation with the date part, but I don't understand what you're trying to do with that table after it's created. Could you clarify a little? Joe Miller
joe.miller@flotech.net
 
Hi, Im trying to load the table into a form but the name has to use the variable date so it loads the new table everyday.

Thanks, Ben
 
In the Open event of form place a line of code that goes like this:

[tt]
Me.RecordSource = "tblAccountSummary-" & format(Date(),"dd/mm/yy")
[/tt]

I did this in a test but rather than doing a variable I set up a control on a form that the form being opened referenced to figure out what table to use. The same logic applies you just have to supply your table name in the proper format. Joe Miller
joe.miller@flotech.net
 
I have come to another problem.... how would I load the table up in a query??

Thanks in advance
 
Read about the QueryDef function in Help. That is what you will need to do to define the query to access. Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top