473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

access problem on date conversion please hlp

I make an import of a huge file txt table with headers at each page
and date format as "20.12.2004"

in order to use the data I first qo a query that exclude all line
representing the headers repeated for each page.

now that I have a txt table with several colums I convert back the
comlumns in to the format I need to perform other table:

I mainly have to convert text fields in to Dates and numbers.

I have a problem with dates:

considering that in the query i always start from a field of a table
that has been imported as a text I have converted the date in the same
way multile times but as soon as I create a new query that select a
group of dates that I previously converted access tells me that there
is eather a "type mismatch" or "invaid use of NULL"

in order to convert the date in string in to a date format I have
tried several formula.

they seams all to work since I obtain a date as in example below in
each of the 3cases: all theses case they convert the date from :
20.01.2004 in to 20/01/2004.

case1)
Data_DocNew2: DateValue(Replace([Data_Doc],".","/"))

case2)
Data_DocNew1: CDate(Replace([Data_Doc],".","/"))

case3)
Data_DocNew: DateSerial(CInt(Right(Trim([Data_Doc]),4)),CInt(Mid(Trim([Data_Doc]),4,2)),CInt(Left(Trim([Data_Doc]),2)))

as soon as I create new query based on the new date with a simple
criteria as filter: >=#01/10/2003# I get in case 1) and 2) "data
mismatch", in case 3) "Invalid use of Null".

can you please help?

Giulio
Nov 13 '05 #1
2 1893
Are you sure you have a value for Data_Doc for all rows? The errors you're
getting would imply that at least one row has a Null value for Data_Doc.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Giulio" <re*****@tiscali.it> wrote in message
news:26**************************@posting.google.c om...
I make an import of a huge file txt table with headers at each page
and date format as "20.12.2004"

in order to use the data I first qo a query that exclude all line
representing the headers repeated for each page.

now that I have a txt table with several colums I convert back the
comlumns in to the format I need to perform other table:

I mainly have to convert text fields in to Dates and numbers.

I have a problem with dates:

considering that in the query i always start from a field of a table
that has been imported as a text I have converted the date in the same
way multile times but as soon as I create a new query that select a
group of dates that I previously converted access tells me that there
is eather a "type mismatch" or "invaid use of NULL"

in order to convert the date in string in to a date format I have
tried several formula.

they seams all to work since I obtain a date as in example below in
each of the 3cases: all theses case they convert the date from :
20.01.2004 in to 20/01/2004.

case1)
Data_DocNew2: DateValue(Replace([Data_Doc],".","/"))

case2)
Data_DocNew1: CDate(Replace([Data_Doc],".","/"))

case3)
Data_DocNew: DateSerial(CInt(Right(Trim([Data_Doc]),4)),CInt(Mid(Trim([Data_Doc]),4,2)),C
Int(Left(Trim([Data_Doc]),2)))
as soon as I create new query based on the new date with a simple
criteria as filter: >=#01/10/2003# I get in case 1) and 2) "data
mismatch", in case 3) "Invalid use of Null".

can you please help?

Giulio

Nov 13 '05 #2
Thanks for your answer!
Yes I have double checked, there are no NULL value...

Note: I get the Null answer only in case 3) using the most complex
formula with Date serial:

DateSerial(CInt(Right(Trim([Data_Doc]),4)),CInt(Mid(Trim([Data_Doc]),4,2
)),C
Int(Left(Trim([Data_Doc]),2)))

in case 1)
Data_DocNew2: DateValue(Replace([Data_Doc],".","/"))
and
case2)
Data_DocNew1: CDate(Replace([Data_Doc],".","/"))

I have a small sample file I can send if you could have a look.

thanks

Giulio

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: middletree | last post by:
A couple of days ago, I posted a qusstion as to why my simple form isn't working. The error I get in the browser is: Data type mismatch in criteria expression. /grace/shapethankyou.asp, line 197 ...
27
by: Chuck Grimsby | last post by:
(Repost, due to lack of submissions...) The Microsoft Access Product Group (the people who build Microsoft Access) want your help! One of the main things we're working on for the near future...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
8
by: William Bradley | last post by:
First of all I have been working with Access 97 and this morning the owner of the business phoned me to inform me that he had updated to Access 2000 and parts of my forms would not work anymore. ...
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
12
by: Cy | last post by:
Hello Fellow New Group Folks, Here's today's problem. I was called in to help convert an Access 97 database to Access 2000. 99% of all my Access Dev. work has occurred in 2000, so I know very...
31
by: Cy | last post by:
Hi all, I wanted to start a thread that might help many of us. I worked for a company for 12 years, until this past Christmas when they let me go. Getting rid of the higher dollar guys, in...
0
by: elena | last post by:
Hi, All Please, help with conversion I have database (Access) fields like currency and Date/Time - short Date and short Time. How i can convert string to currency and insert value into db field?...
3
by: Savvas Tsitouridis | last post by:
Hello I have an Access database with a date field The format that we store values is dd/mm/yyyy (greek) The problem is that i can't retreive the correct dates because the queries return only...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.