Solved

Changing recordset dataType without effect the Object

Posted on 2004-10-21
8
323 Views
Last Modified: 2010-08-05
hi
i have for example this code
dim fa as recordset
set fa=currentdb.openrecordset("MyTable").clone

then i would like to change datatype or the data , or remove primary key ..... etc of fa whithout any effect to the structure of MyTable
0
Comment
Question by:rudwan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 125 total points
ID: 12367361
You can't. If you wish to do something like this you can either:

1) Select the fields you want already converted into the appropriate data type within a query.
2) Copy the data into a new table with the appropriate fields of the correct data type.

Why do you wish to do this?
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 12367410
You cant change the actual data type of the source field, you can change the type of the data returned in the query using one of the convert functions CLng([YourField]), CStr([YourField]) etc...


Alan
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 12367418
Type Conversion Functions
Each function coerces an expression to a specific data type.

Syntax
CBool(expression)
CByte(expression)
CCur(expression)
CDate(expression)
CDbl(expression)
CDec(expression)
CInt(expression)
CLng(expression)
CSng(expression)
CStr(expression)
CVar(expression)

Alan

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:rudwan
ID: 12369633
I dislike to change any thing from the source table
I need only to take a copy of the data in a recordset , then change what I need from this new recordset far a way  of the datasource , then close the code and remove the reordset
0
 

Author Comment

by:rudwan
ID: 12387403
where is the experts ?
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12387964
Well, what exactly are you doing with this data that requires the datatype to be changed?
0
 

Author Comment

by:rudwan
ID: 12392018
look to this post shane
http://www.experts-exchange.com/Databases/MS_Access/Q_21171347.html
finally , i think to take the randomized IDs and create another table
and add the current ID to it
then again randimize the IDs to get the result
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12392628
I don't see anything in that post that explains why you need to change the data type. If you wish to insert a record into a new table while changing the field data type, just change it as you put the data in a new field. For example, if the original is a text and you want to change it to a numeric field:
rsNew!SomeField = CLng(rsOld!SomeField)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question