A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Convert text to Date



 
 
Thread Tools Display Modes
  #11  
Old May 21st, 2008, 11:29 AM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Convert text to Date

Your syntax is incorrect for the CDate function. Try

CDate(Format(DATUM,0000\-00\-00))

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


"catharinus van der werf"
wrote in message ...
Hello to you all,

I tried the statement in my query to insert a text file in an accces
database, but it failed. Don't know why. Please help:
The statement:

Call conConnection.Execute("INSERT INTO [TABELB] (DATUM) SELECT
CDATE(DATUM,0000\-00\-00) AS DATUM FROM [text;HDR=NO;DATABASE=" &
App.Path &
"\telebank\gtz].[table4.asc]")


catharinus van der werf



"Douglas J. Steele" wrote:

Yes. When you're importing, click on the Advanced button in the bottom
left-hand corner of the wizard. Set the field's Data Type to Date/Time,
set
the Date Order to YMD, set the Date Delimiter to nothing and check the
Four
Digit Year checkbox.

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


"Jasper Recto" wrote in message
...
We have dates that are in this format:

20080513

This is the date for 5/13/2008

If I import data from a text file that has this format, how can I
convert
it to a regular date field before it goes into my database?

Thanks,
Jasper






  #12  
Old May 21st, 2008, 01:05 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus van der werf
external usenet poster
 
Posts: 6
Default Convert text to Date

He Douglas
thank you.
the format-statement did it,though you probarly forgot the quote-sign
I think the statement should be: CDATE(FORMAT(DATUM,'0000\-00\-00'))

Thanks a lot, you're the best and quickest.

Catharinus van der Werf



"Douglas J. Steele" wrote:

Your syntax is incorrect for the CDate function. Try

CDate(Format(DATUM,0000\-00\-00))

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


"catharinus van der werf"
wrote in message ...
Hello to you all,

I tried the statement in my query to insert a text file in an accces
database, but it failed. Don't know why. Please help:
The statement:

Call conConnection.Execute("INSERT INTO [TABELB] (DATUM) SELECT
CDATE(DATUM,0000\-00\-00) AS DATUM FROM [text;HDR=NO;DATABASE=" &
App.Path &
"\telebank\gtz].[table4.asc]")


catharinus van der werf



"Douglas J. Steele" wrote:

Yes. When you're importing, click on the Advanced button in the bottom
left-hand corner of the wizard. Set the field's Data Type to Date/Time,
set
the Date Order to YMD, set the Date Delimiter to nothing and check the
Four
Digit Year checkbox.

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


"Jasper Recto" wrote in message
...
We have dates that are in this format:

20080513

This is the date for 5/13/2008

If I import data from a text file that has this format, how can I
convert
it to a regular date field before it goes into my database?

Thanks,
Jasper







  #13  
Old May 21st, 2008, 01:24 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Convert text to Date

Yes, you're right. I forgot the quotes. The perils of copy-and-paste!

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


"catharinus van der werf"
wrote in message ...
He Douglas
thank you.
the format-statement did it,though you probarly forgot the quote-sign
I think the statement should be: CDATE(FORMAT(DATUM,'0000\-00\-00'))

Thanks a lot, you're the best and quickest.

Catharinus van der Werf



"Douglas J. Steele" wrote:

Your syntax is incorrect for the CDate function. Try

CDate(Format(DATUM,0000\-00\-00))

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


"catharinus van der werf"

wrote in message
...
Hello to you all,

I tried the statement in my query to insert a text file in an accces
database, but it failed. Don't know why. Please help:
The statement:

Call conConnection.Execute("INSERT INTO [TABELB] (DATUM) SELECT
CDATE(DATUM,0000\-00\-00) AS DATUM FROM [text;HDR=NO;DATABASE=" &
App.Path &
"\telebank\gtz].[table4.asc]")


catharinus van der werf



"Douglas J. Steele" wrote:

Yes. When you're importing, click on the Advanced button in the bottom
left-hand corner of the wizard. Set the field's Data Type to
Date/Time,
set
the Date Order to YMD, set the Date Delimiter to nothing and check the
Four
Digit Year checkbox.

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


"Jasper Recto" wrote in message
...
We have dates that are in this format:

20080513

This is the date for 5/13/2008

If I import data from a text file that has this format, how can I
convert
it to a regular date field before it goes into my database?

Thanks,
Jasper









  #14  
Old May 27th, 2008, 12:04 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 21 mei, 14:05, catharinus van der werf
wrote:
He Douglas
thank you.
the format-statement did it,though you probarly forgot the quote-sign
I think the statement should be: CDATE(FORMAT(DATUM,'0000\-00\-00'))

Thanks a lot, you're the best and quickest.

Catharinus van der Werf
"Douglas J. Steele" wrote:
Your syntax is incorrect for the CDate function. Try


CDate(Format(DATUM,0000\-00\-00))


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


"catharinus van der werf"
wrote in ....
Hello to you all,


I tried the statement in my query to insert a text file in an accces
database, but it failed. Don't know why. Please help:
The statement:


Call conConnection.Execute("INSERT INTO [TABELB] (DATUM) SELECT
CDATE(DATUM,0000\-00\-00) AS DATUM *FROM [text;HDR=NO;DATABASE=" &
App.Path &
"\telebank\gtz].[table4.asc]")


catharinus van der werf


"Douglas J. Steele" wrote:


Yes. When you're importing, click on the Advanced button in the bottom
left-hand corner of the wizard. Set the field's Data Type to Date/Time,
set
the Date Order to YMD, set the Date Delimiter to nothing and check the
Four
Digit Year checkbox.


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


"Jasper Recto" wrote in message
.. .
We have dates that are in this format:


20080513


This is the date for 5/13/2008


If I import data from a text file that has this format, how can I
convert
it to a regular date field before it goes into my database?


Thanks,
Jasper


  #15  
Old May 27th, 2008, 02:43 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 21 mei, 14:24, "Douglas J. Steele"
wrote:
Yes, you're right. I forgot the quotes. The perils of copy-and-paste!

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

"catharinusvan der werf"
wrote in ...



He Douglas
thank you.
the format-statement did it,though you probarly forgot the quote-sign
I think the statement should be: CDATE(FORMAT(DATUM,'0000\-00\-00'))


Thanks a lot, you're the best and quickest.


Catharinusvan der Werf


"Douglas J. Steele" wrote:


Your syntax is incorrect for the CDate function. Try


CDate(Format(DATUM,0000\-00\-00))


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


"catharinusvan der werf"

wrote in message
...
Hello to you all,


I tried the statement in my query to insert a text file in an accces
database, but it failed. Don't know why. Please help:
The statement:


Call conConnection.Execute("INSERT INTO [TABELB] (DATUM) SELECT
CDATE(DATUM,0000\-00\-00) AS DATUM *FROM [text;HDR=NO;DATABASE=" &
App.Path &
"\telebank\gtz].[table4.asc]")


catharinusvan der werf


"Douglas J. Steele" wrote:


Yes. When you're importing, click on the Advanced button in the bottom
left-hand corner of the wizard. Set the field's Data Type to
Date/Time,
set
theDateOrder to YMD, set theDateDelimiter to nothing and check the
Four
Digit Year checkbox.


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


"Jasper Recto" wrote in message
.. .
We have dates that are in this format:


20080513


This is thedatefor 5/13/2008


If I import data from a text file that has this format, how can I
convert
it to a regulardatefield before it goes into my database?


Thanks,
Jasper- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Hello Doug,

once aqain, a new problem.

Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.

Please help me.

Catharinus van der Werf

  #16  
Old May 27th, 2008, 02:49 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Convert text to Date

Are you certain that there's a value for the date/time field: that it isn't
Null?

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


"catharinus" wrote in message
...

Hello Doug,

once aqain, a new problem.

Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.

Please help me.

Catharinus van der Werf



  #17  
Old May 27th, 2008, 03:42 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 27 mei, 15:49, "Douglas J. Steele"
wrote:
Are you certain that there's a value for thedate/time field: that it isn't
Null?

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

"catharinus" wrote in message

...

Hello Doug,

once aqain, a new problem.

Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.

Please help me.

Catharinusvan der Werf


Hello Doug,
yes, there are always values. In fact, I use the same text-file to
import in to different access-database. But only in one of these
databases, I get this message.
Very strange.

Catharinus van der Werf

  #18  
Old May 27th, 2008, 04:23 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 27 mei, 16:42, catharinus wrote:
On 27 mei, 15:49, "Douglas J. Steele"





wrote:
Are you certain that there's a value for thedate/time field: that it isn't
Null?


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


"catharinus" wrote in message


...


Hello Doug,


once aqain, a new problem.


Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.


Please help me.


Catharinusvan der Werf


Hello Doug,
yes, there are always values. In fact, I use the same text-file to
import in to different access-database. But only in one of these
databases, I get this message.
Very strange.

Catharinusvan der Werf
- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

Hello Doug,

deep shame, the problem was caused by not setting the column-width in
the text-file that I imported in the access-database. Thanks for your
help anyway

Catharinus van der Werf


  #19  
Old May 27th, 2008, 04:26 PM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 27 mei, 16:42, catharinus wrote:
On 27 mei, 15:49, "Douglas J. Steele"





wrote:
Are you certain that there's a value for thedate/time field: that it isn't
Null?


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


"catharinus" wrote in message


...


Hello Doug,


once aqain, a new problem.


Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.


Please help me.


Catharinusvan der Werf


Hello Doug,
yes, there are always values. In fact, I use the same text-file to
import in to different access-database. But only in one of these
databases, I get this message.
Very strange.

Catharinusvan der Werf
- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -


Hello Doug,

I found it. The problem was caused by not setting the columnwidth of
the columns in the imported textfile correcty .

Thanks for your help anyway,

Catharinus van der Werf


  #20  
Old June 3rd, 2008, 09:46 AM posted to microsoft.public.access.forms,microsoft.public.access.queries,microsoft.public.access
catharinus
external usenet poster
 
Posts: 27
Default Convert text to Date

On 27 mei, 17:26, catharinus wrote:
On 27 mei, wrote:





On 27 mei, 15:49, "Douglas J. Steele"


wrote:
Are you certain that there's a value for thedate/time field: that it isn't
Null?


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


"catharinus" wrote in message


...


Hello Doug,


once aqain, a new problem.


Sometimes a got this message: data type mismatch in criteria
expreskon.
The field in the access table is of type Data/Time, so what can be
wrong.
In one access database, there are no problems, in another I got this
message.


Please help me.


Catharinusvan der Werf


Hello Doug,
yes, there are always values. In fact, I use the same text-file to
import in to different access-database. But only in one of these
databases, I get this message.
Very strange.


Catharinusvan der Werf
- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Hello Doug,

I found it. The problem was caused by not setting the columnwidth of
the columns in the imported textfile correcty .

Thanks for your help anyway,

Catharinusvan der Werf
- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -


Hello Doug,

I keep having problems to insert the correct records. I want to insrt
records
dated after for example 20-12-2007,. I tried to use the next
statement, but that doesn't work:
"INSERT INTO [TABELB] (PERIODE,Datum) SELECT 0 as
periode,CDATE(FORMAT(DATUM,'0000\-00\-00')) as datum) FROM
[text;HDR=NO;DATABASE=" & App.Path & "\telebank\Postbank].[table4.asc]
WHERE DATUM between #" & Format(cpDatumVanaf, "mm/dd/yyyy") & "# and
#" & Format(cpTotDatum, "mm/dd/yyyy") & "#")

Please help
Catharinus van der Werf





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.