Unanswered: Database - dynamic tables - use dynamic - sql and loop, querying a column
Let me begin. I have a database that is used to import a file, run queries and output them into a spreadsheet template. Sound easy? its not!
The only 2 static fields of the table are Time & Seconds. After that several other fields are added, each of these extra fields represents a node. I need to run 7 queries on each node and export them to a spreadsheet template and save it. My database is not normalised but im not sure if its going to need to be.
Does anyone know if it would be possible to count the amount of fields that are imported, save them to some kind of array and loop, querying a column at a time probabally using somekind of dynamic sql.
If this sounds possible and anyone could help me, please do. Im really stuck with this and the sooner i can fix it the better.
Ok, i went and did a bit of research and came back with this.. i think it looks at the imported field names and adds a name to each of the columns. I added the count function to this but will it now only adds names to the fields imported and not the rest of the fields? That is what im aiming for.
Public Sub addtablenames()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set db = CurrentDb
Set tdf = db.TableDefs("tblImportTableTest")
For Each fld In tdf.Fields
Set tdf = Nothing
Set db = Nothing