[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

Changing recordset dataType without effect the Object

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
rudwan
Asked:
rudwan
  • 3
  • 3
  • 2
1 Solution
 
shanesuebsahakarnCommented:
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
 
Alan WarrenCommented:
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
 
Alan WarrenCommented:
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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
rudwanAuthor Commented:
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
 
rudwanAuthor Commented:
where is the experts ?
0
 
shanesuebsahakarnCommented:
Well, what exactly are you doing with this data that requires the datatype to be changed?
0
 
rudwanAuthor Commented:
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
 
shanesuebsahakarnCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now