Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 10th, 2003, 09:15 PM
Roaster Roaster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Roaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old December 11th, 2003, 06:52 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
I think your way won't work out!..U can use sql statement to alter the database field's name!..Good luck!

Reply With Quote
  #3  
Old December 11th, 2003, 03:27 PM
Roaster Roaster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Roaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old December 11th, 2003, 07:05 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,957 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 19 sec
Reputation Power: 802
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.

Reply With Quote
  #5  
Old December 12th, 2003, 12:29 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Hi,Doug G! I couldn't find any useful knowledge about how to change the fieldname by using ADOX..Can u figure it out??

Reply With Quote
  #6  
Old December 14th, 2003, 08:13 PM
Roaster Roaster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Roaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #7  
Old December 15th, 2003, 11:24 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,957 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 19 sec
Reputation Power: 802
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

Reply With Quote
  #8  
Old December 15th, 2003, 06:44 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
How can i reference ADOX component in vb??

Reply With Quote
  #9  
Old December 15th, 2003, 10:37 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,957 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 19 sec
Reputation Power: 802
Look for Microsoft ADO Ext for DDL and Security. ADOX is distributed along with ADO when you install Microsoft's MDAC.

Reply With Quote
  #10  
Old December 16th, 2003, 06:39 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Thx for your reply!Doug G!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > does anyone know how to edit access field names?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT