472,358 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

Number format change to text

Hi,

I hope someone can give me some solutions to these problems I faced.

I imported some data to Excel. Then in Access, I table-linked to this file. I have two fields which in Excel is in number format but in Access, these fields property is text and the values in these fields become "#Num!". Others number format fields were okay, only these two fields (or particular columns?).

But if I linked directly to the datasource, it seems the properties remains as number format. However, i do not want to linked directly to the main datasource as I only want specific fields (about 20 out of 100 over fields). The Access file size become very big after refresh.

Another issue with direct linked to the main datasource is I can't see all the fields although I can see all fields in Excel when I do a database query.
Any ideas on this?

Thank you in advance for your help.
Jul 19 '07 #1
1 4495
JConsulting
603 Expert 512MB
Hi,

I hope someone can give me some solutions to these problems I faced.

I imported some data to Excel. Then in Access, I table-linked to this file. I have two fields which in Excel is in number format but in Access, these fields property is text and the values in these fields become "#Num!". Others number format fields were okay, only these two fields (or particular columns?).

But if I linked directly to the datasource, it seems the properties remains as number format. However, i do not want to linked directly to the main datasource as I only want specific fields (about 20 out of 100 over fields). The Access file size become very big after refresh.

Another issue with direct linked to the main datasource is I can't see all the fields although I can see all fields in Excel when I do a database query.
Any ideas on this?

Thank you in advance for your help.
Use this function to convert your .xls file to a .csv file prior to importing. Because it's now a comma delimited file, you can use TransferText to import the data while creating an import Specification. You can set the field types and names there, as well as saving the Specification as a name that you can use in code again and again.

Expand|Select|Wrap|Line Numbers
  1. Function ConvertXLS(strXLSFile As String) As String
  2. ' This function converts a Excel file to a CSV file
  3.     Dim xlApp As Object
  4.     Dim xlwb As Object
  5.     Dim strCSVFile As String
  6.     strCSVFile = Left(strXLSFile, Len(strXLSFile) - 3) & "csv"
  7.     Set xlApp = CreateObject("Excel.Application")
  8.     Set xlwb = xlApp.Workbooks.Open(strXLSFile, True)
  9.     xlApp.Visible = False
  10.     xlwb.SaveAs strCSVFile, xlCSV
  11.     xlwb.Close (False)
  12.     xlApp.Quit
  13.     Set xlApp = Nothing
  14.     ConvertXLS = strCSVFile
  15. End Function
  16.  
J
Aug 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: simina | last post by:
Hi... I have a form with 4 number fields: phone area, phone number, cell area, cell number. I did a function that checks the "number" issue for all 4 fields in the same time (because the code is...
2
by: John S | last post by:
I have created an event handler that is trying to format each number as it is typed. Example If the first char is 1 = output is $1.00 second char is 3 = output is $13.00 next is 5 = $135.00...
0
by: codeproblems | last post by:
============= XML content ================== <?xml version="1.0"?> <cdb> <spill> <ctx_volume>142300000</ctx_volume> <date>19670318</date> <shipname>TORREY CANYON</shipname> </spill>...
4
by: Orchid | last post by:
How can I change a Date datatype to a Number datatype? For example, I want a date 10/31/2006 to show 1031 as Number datatype. But I don't want it becomes 39021. What formula should I use? ...
10
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I...
7
by: buddyr | last post by:
Hello, I am in microsoft access form - I want a field called serial number to have number display with 3 zeros before it. the serial number is always 5 digits. I have tried putting "00000000" in...
1
by: Brian | last post by:
Hello, I am new to Microsoft access 2007 and I have created a new database. There is a dollar about that I have to change from text to currency format. Also, there is a zip code that I have to...
4
by: grego9 | last post by:
I have two tables that are linked by a common field called 'reference'. i am running a query and want the query to post a text of "EXCHANGE OV CHANGE" against each record where a field called "ORIG...
29
by: kstevens | last post by:
I have a form with 12 unbound comboboxes whose query is determined from the combobox before it. Example: No2 box rowsource is set to the query and then requeried on the afterupdate of box1. Now...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.