Solved

Changing recordset dataType without effect the Object

Posted on 2004-10-21
8
320 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

867 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

19 Experts available now in Live!

Get 1:1 Help Now