473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Repla ce([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(Le ft(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 1918
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*****@tiscal i.it> wrote in message
news:26******** *************** ***@posting.goo gle.com...
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(Repla ce([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(Repla ce([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
8205
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 The error I get when I try to run it in Access 2000 is that it's a "Type conversion failure" The SQL Statement is: INSERT INTO
27
3617
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 is a conversion tool to take Microsoft Access 97 databases (primarily, but also Microsoft Access 2000 or 2002/XP databases) up to Microsoft Office Access 2003. For us to do this, we need sample databases from *you*, our customers, to ensure a...
1
8174
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 fields. 177 102003 16:43:12 102003 18:43:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 165 102003 17:43:12 102003 18:44:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 177 102003 16:41:18 102003 18:45:12 6OAG0ADP Y 0000 0000 0000 0000 61930...
8
2069
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. On my form I have a field "Expiry Date".When I put the following into the AfterUpdate field, it adds 183 days to the current date, and displays it in the "Expiry Date" field. Me.ExpDate = DateAdd("d", 183, Me.Date)
4
2537
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 my recordset did not. i read from pasts posts that some references will not convert. so i tried to change the dao 3.51 reference to dao 3.6 in access 97. then i imported all of the objects into an access 2003. it did not work. so my second...
12
2249
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 little about 97, however, from everything I read, it sounded like a conversion from 97 to 2000 should go smoothly. Boy was I wrong. Here's what we got. There is a form, that lists a group of employees. There is a command button, that when...
31
3005
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 favor of more profit, was the reasoning. Oh well. Anyhow. I built this companies network from the ground up. Then about 8 years ago, I developed a MS Access 2.0 database. This database, much like others, was supposed to just tiny bits. Over...
0
1582
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? cmd.Parameters.Add("@Date", OleDbType.DBDate).Value = @dt; cmd.Parameters.Add("@Time", OleDbType.DBTime).Value = @td; cmd.Parameters.Add("@Amt", OleDbType.Currency).Value = @scur;
3
2805
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 the english format dates. How to format the query to english date format (mm/dd/yyyy)? Thank you
0
8372
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.