dschomburg
MIS
Greetings,
I have a table with 1 field = "Report_Name". The table (surprisingly enough) contains the names of reports - which have been imported to various tmp tables.
I have a varible declared = SrcTable as string.
Here is my code thus far.
SrcTable = "PCIM9METTM" 'this is the report name
DoCmd.RunSQL "SELECT IIf(Left([Field2],3)='JOB','',IIf(Left([Field2],3)='PGM','',Trim([Field2]))) AS Test1, " & SrcTable & ".Field3, " & SrcTable & ".Field4, " & SrcTable & ".Field5, IIf(Left([Field7],1)='-',[Field6] & '-',[Field6]) AS test2 INTO tmp_Table_Type_1 FROM " & SrcTable & ";"
What I am struggling with is how to use each Report_Name field value from the "tbl_Report_Names" table via a loop I'm guessing to populate the value of the variable "SrcTable"
Does this make any sense? Is there an easier way, am I on the right track?
Any assistance is greatly apprciated.
Thanks,
Dave
I have a table with 1 field = "Report_Name". The table (surprisingly enough) contains the names of reports - which have been imported to various tmp tables.
I have a varible declared = SrcTable as string.
Here is my code thus far.
SrcTable = "PCIM9METTM" 'this is the report name
DoCmd.RunSQL "SELECT IIf(Left([Field2],3)='JOB','',IIf(Left([Field2],3)='PGM','',Trim([Field2]))) AS Test1, " & SrcTable & ".Field3, " & SrcTable & ".Field4, " & SrcTable & ".Field5, IIf(Left([Field7],1)='-',[Field6] & '-',[Field6]) AS test2 INTO tmp_Table_Type_1 FROM " & SrcTable & ";"
What I am struggling with is how to use each Report_Name field value from the "tbl_Report_Names" table via a loop I'm guessing to populate the value of the variable "SrcTable"
Does this make any sense? Is there an easier way, am I on the right track?
Any assistance is greatly apprciated.
Thanks,
Dave