473,769 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can VB6 alter the NAME of an EXISTING FIELD in ACCESS 2002???

I'm sorry if this one has been asked and answered a million times:

Is it possible to have a VB6 app alter the name of an *existing* field
in Access 2002 database? To be clear, I'm not talking about adding a
new field to the Access database. I want to change the name of an
*existing* field using a VB6 app.

What type of VB6 code would you use to do this? And please, if your
suggestion involves using Project References other than "Microsoft
Access 10.0 Object Library" and "Microsoft ActiveX Data Objects 2.7
Library", please specify which References I would need to add to the
Project to accommodate your suggestion.

I really appreciate your help.
Sep 16 '06 #1
2 3350
Alan Mailer wrote:
I'm sorry if this one has been asked and answered a million times:

Is it possible to have a VB6 app alter the name of an *existing* field
in Access 2002 database? To be clear, I'm not talking about adding a
new field to the Access database. I want to change the name of an
*existing* field using a VB6 app.

What type of VB6 code would you use to do this? And please, if your
suggestion involves using Project References other than "Microsoft
Access 10.0 Object Library" and "Microsoft ActiveX Data Objects 2.7
Library", please specify which References I would need to add to the
Project to accommodate your suggestion.

I really appreciate your help.
This one-liner seems to work from within Access. I'm not sure how to
adapt it to an external app, but it might be as easy as pre-pending the
database's object reference?

DBEngine(0)(0). TableDefs("MyTa ble").Fields("O ldName").Name = "NewName"

--
Smartin
Sep 16 '06 #2
Using ADO you can

loCon.Execute "ALTER TABLE Table2 ADD COLUMN [Val1] varchar(50)"
loCon.Connectio n.Execute "UPDATE Table2 SET [Val1] = [Value]"
loCon.Connectio n.Execute "ALTER TABLE Table2 DROP COLUMN [Value]"

Where loCon is you connection object.

Alternatively create a reference to ADOX and then use that to create the
column instead of line 1 above (best done if this is going to be generic as
you can then replicate the attributes of the source field to the target
field).

--

Terry Kreft
"Alan Mailer" <cl**********@e arthlink.netwro te in message
news:v3******** *************** *********@4ax.c om...
I'm sorry if this one has been asked and answered a million times:

Is it possible to have a VB6 app alter the name of an *existing* field
in Access 2002 database? To be clear, I'm not talking about adding a
new field to the Access database. I want to change the name of an
*existing* field using a VB6 app.

What type of VB6 code would you use to do this? And please, if your
suggestion involves using Project References other than "Microsoft
Access 10.0 Object Library" and "Microsoft ActiveX Data Objects 2.7
Library", please specify which References I would need to add to the
Project to accommodate your suggestion.

I really appreciate your help.

Sep 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9840
by: Dylan Nicholson | last post by:
Seems that Oracle 9.2 (using MS ODBC driver) requires extra parentheses when adding multiple columns to a table: ALTER TABLE MyTable ADD (MyColumn1 VARCHAR(255), MyColumn2 VARCHAR(255)) vs ALTER TABLE MyTable ADD MyColumn1 VARCHAR(255), MyColumn2 VARCHAR(255)
2
21356
by: me | last post by:
I would like to add an Identity to an existing column in a table using a stored procedure then add records to the table and then remove the identity after the records have been added or something similar. here is a rough idea of what the stored procedure should do. (I do not know the syntax to accomplish this can anyone help or explain this? Thanks much, CBL
1
6321
by: Euler Almeida via SQLMonster.com | last post by:
Hi people, I?m trying to alter a integer field to a decimal(12,4) field in MSACCESS 2K. Example: table : item_nota_fiscal_forn_setor_publico field : qtd_mercadoria integer NOT NULL ALTER TABLE item_nota_fiscal_forn_setor_publico ALTER COLUMN qtd_mercadoria decimal(12,4) NOT NULL
2
5100
by: HjKlOp | last post by:
Can I set fields lenghts of an existing database with "ALTER TABLE" command without lost data ?
1
3404
by: jdph40 | last post by:
I have a table with fields EmpID (PK), EmployeeNumber, DateTaken, and YearTaken to track the dates an employee takes for vacation. I need a way to distinguish between years because the data will be from multiple years (i.e., 2003, 2004). In my query, I set a parameter ("Enter year..."), so in my reports and on forms I can see only one year at a time. My problem is that in my form, I don't want the user to have to enter the date...
5
5301
by: minjie | last post by:
Is it possible to run a simple script to alter a table column in Access database from an interger to a double? I have been writing C++ programs every time we need to upgrade (modify) the Access database, but found it cumbersome. I know I can change database definition via Access GUI interface itself, but if the database is at a remote site, and if I don't want the users to mess around with the database by themselves, then I have to...
9
3063
by: Alan Mailer | last post by:
Ok, my Access 2002 language writing skills are VERY rusty,. I would know how to do what I need using SQL Server's "Coalesce' function, but I don't have that available to me in the Access 2002 database I'm currently programming. ....So could someone advise me how to add an Expression Field to a Access 2002 Query that will reflect the following: Imagine I want a field that derives from Fields in a table I've called tblContacts. ...
3
5281
by: sparks | last post by:
several months ago I was trying to set the field size of text fields in a table and Lyle Fairfield was nice enought to post a way using alter column. it was surprising since it was ALTER COLUMN f5 Text(250) WHERE in the world can I find the a listing of the different things that can be done with this?
2
6715
by: rcamarda | last post by:
Hello, I need to alter fields in all my tables of a given database, and I would to do this via a t-sql script. Example, I want to change all fields called SESSION_ID to char(6). The field is usually varchar(10), but the data is always 6 characters in length. I have serveral fields that are fixed length that I want to move from varchar to char. I believe I can find all the tables where the field exists using select * from...
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8879
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.