Solved

Changing recordset dataType without effect the Object

Posted on 2004-10-21
8
319 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
  • 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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now