|
|
Hello,
After a practice of doing traansfer database, I need to change the FieldName. Ah, I can change the fieldName, if the transfertext, but what if the transferdatabase of DBASE type. Can we change the FieldNames as transfertext type?
If yes , please let me some information of how to do.
Thanks ,
|
|
On Mon, 24 Nov 2008 00:35:01 -0800, ooxx wrote:
[Quoted Text] > Hello, > > After a practice of doing traansfer database, I need to change the > FieldName. Ah, I can change the fieldName, if the transfertext, but what if > the transferdatabase of DBASE type. Can we change the FieldNames as > transfertext type? > > If yes , please let me some information of how to do. > > Thanks ,
Do you know in advance what the existing name of the field is? Do you know in advance, what the new name should be? After the import is completed you can run this procedure:
Public Sub ChangeFieldName() Dim tbf As TableDef Dim fld As Field Dim db As DAO.Database Set db = CurrentDb Set tbf = db("ImportedTableName") Set fld = tbf("ExistingFieldName") fld.Name = "NewFieldName" db.Close Set db = Nothing End Sub
If you do not know in advance what the existing Table and/or Field names will be, you can use an input box to ask for the name instead of hard coding it.
..... Dim strTable as String Dim strField as String strTable = InputBox("Enter Table Name") strField = InputBox("Enter the Field Name") ....etc... Set tbf = db(strTable) Set fld = tbf(strFieldName) fld.Name = "NewFieldName" ....etc... -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
Hello,
That's what I need, but I have something. I need not to know the old FieldNames. I need to change them without knowing the old Fieldnames. Whatever the the old FieldNames, just let them be. I think, unless you could show the old Fieldnames up, otherwise you woudn't.
Thanks, "fredg" wrote:
[Quoted Text] > On Mon, 24 Nov 2008 00:35:01 -0800, ooxx wrote: > > > Hello, > > > > After a practice of doing traansfer database, I need to change the > > FieldName. Ah, I can change the fieldName, if the transfertext, but what if > > the transferdatabase of DBASE type. Can we change the FieldNames as > > transfertext type? > > > > If yes , please let me some information of how to do. > > > > Thanks , > > Do you know in advance what the existing name of the field is? > Do you know in advance, what the new name should be? > After the import is completed you can run this procedure: > > Public Sub ChangeFieldName() > Dim tbf As TableDef > Dim fld As Field > Dim db As DAO.Database > Set db = CurrentDb > Set tbf = db("ImportedTableName") > Set fld = tbf("ExistingFieldName") > fld.Name = "NewFieldName" > db.Close > Set db = Nothing > End Sub > > If you do not know in advance what the existing Table and/or Field > names will be, you can use an input box to ask for the name instead of > hard coding it. > > ..... > Dim strTable as String > Dim strField as String > strTable = InputBox("Enter Table Name") > strField = InputBox("Enter the Field Name") > ....etc... > Set tbf = db(strTable) > Set fld = tbf(strFieldName) > fld.Name = "NewFieldName" > ....etc... > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail >
|
|
Hi,
Do you know the method of how to show the old FieldNames?
Thanks,
"fredg" wrote:
[Quoted Text] > On Mon, 24 Nov 2008 00:35:01 -0800, ooxx wrote: > > > Hello, > > > > After a practice of doing traansfer database, I need to change the > > FieldName. Ah, I can change the fieldName, if the transfertext, but what if > > the transferdatabase of DBASE type. Can we change the FieldNames as > > transfertext type? > > > > If yes , please let me some information of how to do. > > > > Thanks , > > Do you know in advance what the existing name of the field is? > Do you know in advance, what the new name should be? > After the import is completed you can run this procedure: > > Public Sub ChangeFieldName() > Dim tbf As TableDef > Dim fld As Field > Dim db As DAO.Database > Set db = CurrentDb > Set tbf = db("ImportedTableName") > Set fld = tbf("ExistingFieldName") > fld.Name = "NewFieldName" > db.Close > Set db = Nothing > End Sub > > If you do not know in advance what the existing Table and/or Field > names will be, you can use an input box to ask for the name instead of > hard coding it. > > ..... > Dim strTable as String > Dim strField as String > strTable = InputBox("Enter Table Name") > strField = InputBox("Enter the Field Name") > ....etc... > Set tbf = db(strTable) > Set fld = tbf(strFieldName) > fld.Name = "NewFieldName" > ....etc... > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail >
|
|
Hi,
I just don't know the possible ways. Could New Fieldnames replace the old without knowing the old Fieldnames?
Thanks,
"fredg" wrote:
[Quoted Text] > On Mon, 24 Nov 2008 00:35:01 -0800, ooxx wrote: > > > Hello, > > > > After a practice of doing traansfer database, I need to change the > > FieldName. Ah, I can change the fieldName, if the transfertext, but what if > > the transferdatabase of DBASE type. Can we change the FieldNames as > > transfertext type? > > > > If yes , please let me some information of how to do. > > > > Thanks , > > Do you know in advance what the existing name of the field is? > Do you know in advance, what the new name should be? > After the import is completed you can run this procedure: > > Public Sub ChangeFieldName() > Dim tbf As TableDef > Dim fld As Field > Dim db As DAO.Database > Set db = CurrentDb > Set tbf = db("ImportedTableName") > Set fld = tbf("ExistingFieldName") > fld.Name = "NewFieldName" > db.Close > Set db = Nothing > End Sub > > If you do not know in advance what the existing Table and/or Field > names will be, you can use an input box to ask for the name instead of > hard coding it. > > ..... > Dim strTable as String > Dim strField as String > strTable = InputBox("Enter Table Name") > strField = InputBox("Enter the Field Name") > ....etc... > Set tbf = db(strTable) > Set fld = tbf(strFieldName) > fld.Name = "NewFieldName" > ....etc... > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail >
|
|
|