Access VBA Problem in Access 2007 - Help

Joined
Feb 9, 2012
Messages
2
Reaction score
0
Hello, I am new in the forum.
I have a problem with Access 2007.
I have created a report with text boxes, each one is related to a query, based on a table Standard (imported from Excel).
I am supposed to create this report for all the excel files I have (around 100); so, once you have imported an excel file "Standard X", you should be able to have displayed the report with the information written in that specific excel file.
The problem is to replicate all the queries, and act in order to have each query "independent", that can fit with all the different tables.
A solution could be to create a new table with one column with all the names of the excel files; then to create a variable "name" to put into a code to run the queries time by time.
The first problem is that I do not know how to create this variable :o

Then, the other problem is how to replicate the queries.This is an example of the SQL view:
SELECT ARM.[Node Id], ARM.Label, ARM.English
FROM ARM
WHERE (((ARM.[Node Id])="2453"));

And this is the code to put the content of the query into the report:
Text17.Value = myDb.QueryDefs("Address").OpenRecordset.Fields(2).Value

I am supposed to substitute the "QueryDefs(...).....Value" with a
myDb.RunSQL(code of the SQL view), but putting in this code the variable "name" that I should have created before.
Can you help me please?
Also suggesting other solutions.
Thanks
 
Back
Top