?
Solved

Changing recordset dataType without effect the Object

Posted on 2004-10-21
8
Medium Priority
?
329 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 250 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

801 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