Extract column names into a string

Colin Coleman

Registered User.
Local time
Today, 12:39
Joined
Jul 25, 2008
Messages
27
Hi,
I need to extract all the field names into a string so i can create a SQL "on the fly", as i need to copy all fields from one table to another Except for a couple of fields.

can anyone give me a clue where to start ?

Regards

Colin:)
 
In VBA type in Tabledefs and hit F1, see if you can go from there.

Tabledefs.Fields(0) will return your first field
Tabledefs.Fields(1) will return your second field
etc...

Good luck
 
expression A variable that represents a Database object. is all it says.....did i do it wrong ?
 
its tabledefs("tablename").fields(0) etc

you may even need

currentdb.tabledefs("tablename").fields(0) etc
 
You have to be a bit more creative, there are some options you can click in the help "Example" seems like a nice one, as well as "Method" or "see also"

These are links on top of the screen in the help.

Also like Gemma allready repeated from my post... (more or less)
tabledefs("tablename").fields(0)
 
seriously, if you want to copy (virtually) the whole table for selected rows into a new table (why incidentally .. archiving?)

I would consider having the cloned record include ALL of the columns of the orgiinal record, even if there were a few non-relevant columns.
 

Users who are viewing this thread

Back
Top Bottom