Hi Y'all I was hoping someone out there might be able to help me.
I have an access program that needs to change the data types
programatically . I have tried to do an alter column to change the
original data type from binary to text, but that did not work. The
current section of code I have is the following:
Public Function ChangeColumnTyp e(ByVal StrgTableName As String, _
strgColumnName As String, StrgNewDataType ) As Boolean
On Error GoTo Err_ChangeColum nType
DoCmd.RunSQL "ALTER TABLE [" & StrgTableName & "] ADD COLUMN [" &
strgColumnName & "-NEW] " & StrgNewDataType
DoCmd.RunSQL "UPDATE [" & StrgTableName & "] SET [" &
strgColumnName & "-NEW] = [" & strgColumnName & "]"
DoCmd.RunSQL "ALTER TABLE [" & StrgTableName & "] DROP COLUMN [" &
strgColumnName & "]"
ChangeColumnTyp e = RenameColumn(St rgTableName, strgColumnName &
"-NEW", strgColumnName)
Exit_ChangeColu mnType:
Exit Function
Err_ChangeColum nType:
MsgBox "There was an Error while changing the Table Column [" &
strgColumnName & "] to [" & _
StrgNewDataType & "] within the Table named [" & StrgTableName & "]
" _
, vbCritical, "Column Retype Error"
GoTo Exit_ChangeColu mnType
End Function
Unfortunately this does not work. For some reason it wont drop the old
attibute and rename the newly created attribute. Instead it errors
out. Anyone have some suggestions? I would appreciate any and all
help.
Thanks,
Erica 2 1443 Er**********@gm ail.com wrote: Hi Y'all I was hoping someone out there might be able to help me.
I have an access program that needs to change the data types programatically . I have tried to do an alter column to change the original data type from binary to text, but that did not work. The current section of code I have is the following:
Public Function ChangeColumnTyp e(ByVal StrgTableName As String, _ strgColumnName As String, StrgNewDataType ) As Boolean
On Error GoTo Err_ChangeColum nType
DoCmd.RunSQL "ALTER TABLE [" & StrgTableName & "] ADD COLUMN [" & strgColumnName & "-NEW] " & StrgNewDataType DoCmd.RunSQL "UPDATE [" & StrgTableName & "] SET [" & strgColumnName & "-NEW] = [" & strgColumnName & "]" DoCmd.RunSQL "ALTER TABLE [" & StrgTableName & "] DROP COLUMN [" & strgColumnName & "]" ChangeColumnTyp e = RenameColumn(St rgTableName, strgColumnName & "-NEW", strgColumnName)
Exit_ChangeColu mnType: Exit Function
Err_ChangeColum nType: MsgBox "There was an Error while changing the Table Column [" & strgColumnName & "] to [" & _ StrgNewDataType & "] within the Table named [" & StrgTableName & "] " _ , vbCritical, "Column Retype Error" GoTo Exit_ChangeColu mnType End Function
Unfortunately this does not work. For some reason it wont drop the old attibute and rename the newly created attribute. Instead it errors out. Anyone have some suggestions? I would appreciate any and all help. Thanks, Erica
As usual I'm going to as "why???". I simply can't see a good reason to
ever dynamically change the database table design like this.
--
regards,
Bradley
A Christian Response http://www.pastornet.net.au/response Er**********@gm ail.com wrote: I have an access program that needs to change the data types programatically . I have tried to do an alter column to change the original data type from binary to text, but that did not work.
What version of Access?
This works in 2003.
CurrentProject. AccessConnectio n.Execute "ALTER TABLE SecondTable ALTER
COLUMN Product1 Text (255)" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eternally |
last post by:
Hey folks,
To me, this sounds like a crazy question, but I'll throw it out there
anyway.
Is it possible to change a variables data type half way through a running
program? If so, how?
You're probably thinking why would you ever want to do that. Valid
question. If you're curious why I'd like to do it, read on. But otherwise,
|
by: iporter |
last post by:
Hi - I am changing a field from type nvarchar to type text, given that
I need to store strings longer than 255 characters. To do this I
change the data type in SQL Server, then I change the parameter code in
the calling procedure, as per below:
cmd.Parameters.Append(cmd.CreateParameter("@title", adVarWChar,
adParamInput, 255, title));
becomes:
|
by: Stefan Finzel |
last post by:
Hi,
is there a way to change the display property on Windows Mobile 2003 SE
Mobile/Pocket Internet Explorer? See following example.
Please note: visibilty property has the same problem.
Is there any other way to display/undisplay parts of web pages?
TIA
|
by: Peter |
last post by:
Can anyone tell me how to change the data type of a field in a table created
with a make table query? The field is a binary and must be changed to text.
alternately does anyone know how to specify the field type when running a
make table query?
Thanks,
Sven
|
by: Geir Baardsen |
last post by:
Hi!
I seem to have some very empty spaces in my head.
Could you help me fill them?
Dim intNumber As Integer
'Get value from field in table that is text
intNumber = DMax("", "tblInvoiceDetails") + 1
'Fill KeyNo-field as the user enters the field
Me!KeyNo = intNumber
| |
by: S P Arif Sahari Wibowo |
last post by:
Hi!
Do you know how to put a form's Access-Visual-Basic-code that will force
the form to be inserted, while the user has not type anything in the form,
without changing focus, selection, etc.?
Here is the story.
I have this structure:
|
by: andychambers2002 |
last post by:
I'm working on a "TempFile" class that stores the data in memory until
it gets larger than a specified threshold (as per PEP 42). Whilst
trying to implement it, I've come across some strange behaviour. Can
anyone explain this?
The test case at the bottom starts a TempFile at size 50 and prints its
type. It then increases the size to the threshold at which point
"self" is changed to being a TemporaryFile. It seems that the next
call...
|
by: alertjean |
last post by:
Or may be I am stubborn or dumb ... of not putting in a * in the
typecast.
This is code I am worrying about
long long b=1;
int *address ;
address=(int)&b;
printf ("%x %x \n",*(address+1)*address);
when I compile the code I get this warning from gcc (although it
|
by: veer |
last post by:
hello expert
can any one help me by providing the method how can i change the data type of column in sql server
originally my column data type is numeric and i want to change it into integer
i use the covert command but it is not changing the data type of column
please provide some help
thanks in advance
|
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...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |