[dba-Tech] Changing Field Names in Tables

Max Wanadoo max.wanadoo at gmail.com
Mon Jul 20 05:52:05 CDT 2009


Hi,
I wanted to import various text files which did not have any header rows.
As you know, Access will provide default names of F1, F2, F3 et seq.

For a particular purpose, I wanted to rename these FieldNames so that I can
match them in code.

Eventually, I came up with the following which I am posting in case it may
help somebody else:

Public Function pfChangeFieldNames
Dim dbs as dao.databse, tdf as dao.tabledef, i as integer, str as string ,
fld as field
Set dbs = currentdb
Set tdf = dbs.tabledefs("mytable")
For each fld in tdf.fields
	Str = fld.name
	Tdf(str).name = "X" & str ' stick an X before the field name
Next fld
Set dbs = nothing : set tdf = nothing
Exit function
End function

You can loop through the field names if you want to change more than one
field name.

Max
Ps Air code - function not avaiable on this machine.


-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence
Sent: 19 July 2009 23:56
To: 'Discussion of Hardware and Software issues'
Subject: [dba-Tech] The Command prompt line length

Hi All:

Has anyone heard of there being a limit of a line length within a batch
file?

I have a batch file that creates a directory and writes some backup data to
it. This batch file works fine on other computers but on a specific computer
the batch files fails on a longer line (64 characters). If the same line is
run in direct mode no problem.

The syntax is correct because if the line is cut and pasted to a command
prompt the line functions correctly. The rest of the batch file runs fine
without that one line... so it is related exclusively to the one line of
code.

Putting that one line of code into a batch file and then running it results
in the same error. It appears that it is not buffering the whole line before
attempting to run it.

If anyone has run across this type of issues before and hopefully found a
solution please pass it on.

TIA
Jim

PS the cmd line of code is:
for /F "tokens=2-4 delims=/ " %i in ('date /t') do set dt=%k%i%j  

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list