|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
does anyone know how to edit access field names?
Hi,
I have a lil problem and seem to be pretty well stumped so if anyone could help me out that would be awesome. The problem i am having is i can't seem to find a way to update/edit field names from a form. The scenario is that the user opens up the form and from here imports the data file into access. once its imported they want to have the option of changing the field names (that where imported with the original data file), ideally i would like to display the imported feild names on one side and via a combo box display a list of new field names that they could replace them with. So far i can do everything except replace the old field name with a new one, does anybody know of anyway that this is possible, it would be a huge help. i was hoping that it could be done similary to how you update your recordsets but obviously it doesnt work, any ideas? (rs.Fields.Item(1).Name 'this displays the value of the feild name in the first column) rs.Edit rs.Fields.Item(1).Name = Combo1.Value rs.Update TIA |
|
#2
|
|||
|
|||
|
I think your way won't work out!..U can use sql statement to alter the database field's name!..Good luck!
|
|
#3
|
|||
|
|||
|
Thanks, bummer though, i was kinda afraid of that, short of using SQL which i really thought there may have been a way do you's have any other ideas? I was thinking possibly of using a table and reading the field names from the imported table into one field and link it to the form and then a combo with the new names and they could update the field names in a new table and then actually create a new table with these new field names and append all of the records into the new table but this seems a pretty long winded way around the problem, surely there has to be a way to just edit existing field names..... got me stumped
|
|
#4
|
|||
|
|||
|
Maybe something here will work for you.
http://msdn.microsoft.com/library/e...tm/adoddlo1.asp I haven't used ADOX myself, but the documentation indicates you can rename columns from adox column objects. |
|
#5
|
|||
|
|||
|
Hi,Doug G! I couldn't find any useful knowledge about how to change the fieldname by using ADOX..Can u figure it out??
|
|
#6
|
|||
|
|||
|
Yay,
got it sorted, thanks heaps for the help there people, good to know that there is some out there!! PS i never did find anything with the adox thing, it seems pretty interesting though |
|
#7
|
|||
|
|||
|
This is a crude example that works on my box to rename an existing MyNewText column in an Access DB.
Code:
Private Sub Command3_Click()
Dim ax As ADOX.Catalog
Dim axt As ADOX.Table
Dim axc As ADOX.Column
Set ax = New ADOX.Catalog
ax.ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';Data Source='c:\lcf\new.mdb'"
Set axt = ax.Tables("MyNewTable")
axt.Columns("MyNewText").Name = "MyRevisedText"
End Sub
|
|
#8
|
|||
|
|||
|
How can i reference ADOX component in vb??
|
|
#9
|
|||
|
|||
|
Look for Microsoft ADO Ext for DDL and Security. ADOX is distributed along with ADO when you install Microsoft's MDAC.
|
|
#10
|
|||
|
|||
|
Thx for your reply!Doug G!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > does anyone know how to edit access field names? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|