473,545 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Ms-Access Field data type thru VB.Net

5 New Member
Hi All,

I am using VB.Net 2003 and Ms-Access 2003. I want to change the data type of fileds programmaticall y. I could not find any method in vb.net to do this.

i) I tried using the sql query "ALTER TABLE TableName ALTER COLUMN FieldName Number" It works for data type like 'Number', 'Memo' etc. But if I want to change to 'Long Integer' (sub type of Number), it does not work.

ii) I tried using ADOX as shown below. It shows the 'Operation is not allowed in this context' error on "adox.Tables(Ta bleName).Column s(FieldName).Ty pe = NewType"

Dim conn As ADODB.Connectio n
conn = CreateObject("A DODB.Connection ")
conn.Open(Conne ction.Connectio nString)
Dim adox As ADOX.Catalog
adox = CreateObject("A DOX.Catalog")
adox.ActiveConn ection = conn
adox.Tables(Tab leName).Columns (FieldName).Typ e = NewType)
adox.Tables.Ref resh()

What am I doing wrong here? Is there any better way to do this? Please somebody help me as this is to be done urgently.

Apr 13 '07 #1
2 2916
41 New Member
Alter Table goes thru the SQL layer which is not fully supported. This may or may help you but is worth the shot. In access turn on the macro recording, then change the type and stop the recording. Now "edit" the macro and you'll see how access needs it or it will give you a hint on how to proceed It saved me a couple of times since sometimes , or should I say lots ;-) , they do funny stuff.

Apr 14 '07 #2
5 New Member
Thanks for your reply.
But I am not sure, how can we record macros in MS-Access (2003). Can you please let me know how can we do this. The following url says, it is not possible.


Apr 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Gary | last post by:
We have had to change the hostname on an SQL server (Blade and the blade moved chassis so name changed) was blade-0-1-5 and is now blade-0-0-12 It seems i need to run 2 stored procedures which are sp_dropserver 'blade-0-1-5', 'droplogins' go sp_addserver 'blade-0-0-12', 'local' go
by: Ronny Sigo | last post by:
Hello all, I am trying to programmatically change the orientation of a MS Word Document to landscape. I must be doing something wrong cause it does not work ... can anybody help me with this? Code is below .... Much obliged ... Ronny Sigo Dim appWD As Object Dim myDoc As Object
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use is: private void ChangeServantStatus(string servant, ServantStatus status) {
by: Christian Blackburn | last post by:
Hi Gang, In VB6 is was relatively easy to change the pointer, but now I don't even see that as a property for any objects. Can somebody tell me how to do that in .NET? Thanks in Advance, Christian Blackburn
by: Richard Bond | last post by:
Hi Is there anyway to change the characterset/codepage of a specific textbox on a winform. I have read in a "chinese traditional big5" file into memory using a streamreader with the appropriate codepage SR = New StreamReader(TBLFilename, System.Text.Encoding.GetEncoding(Cube.CodePage))
by: GY2 | last post by:
I want to step through the rows returned by my DataView, extract some values from some of its columns and append them as separate lines to the text of various rich textbox controls while possibly changing the color of each new line. It seems as though I should use the Lines property but can't find a good example. Below is my attempt to do...
by: WXS | last post by:
In a case you have Project/Assembly A references Project/Assembly B which References Project/Assembly C. Let's say Project A needs be and references it directly. Unknown to A, B needs project C's assembly but it uses C's assembly dynamically (Load Assembly). Even with copy Local set on all references Project A when built will get project...
by: srinivasarv | last post by:
Dear Friends, I want to know how we can change the format of the amount in indian style in MS Acess. Ex : 22,12,24,225/- (Indian style) 221,224,225/- (Foreign style) I want to change the format of the amount in indian style. Please help me in getting the solution
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, we've got a strange problem here: We've created an ASP.NET 2.0 web application using Membership.ValidateUser() to manually authenticate users with our website. The problem is: If the user has the "User must change password" flag set in Active Directory, ValidateUser() always returns false if that user wants to log in.
by: Rainmanjam | last post by:
I have a web site that uses MSN Live Maps. It works in Opera if I change the User Agent to IE. Is there a way to change the User Agent via Javascript for one page?
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...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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. ...
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...
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...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.