View Single Post
  #13  
Old December 23rd, 2004, 02:55 PM
Andi Mayer
external usenet poster
 
Posts: n/a
Default

On Thu, 23 Dec 2004 08:40:40 -0500, "Jan Il"
wrote:

)

Here is what I have now tried:
.Fields("TransactionDate") = Format(Me.txtTransactionDate, "\#mm\/dd\/yyyy
hh\:nn\#\N\u\l\l")

However, now I am getting an Error: Data type conversion error.

The TransactionDate is a date data type, with the date format of mm/dd/yyyy
hh:nn" P". It is a Required field. The format I tried is the one I found
on the link you provided that is closest to the date format I am using;
"\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l", but, I removed the seconds and
whatever the ;;; are, as I did not think they were needed. I've been able
to find out some about this error on the web, but, not having much luck in
finding a cure. I can't figure out what is generating the error.


first try should be everytime the access help

the help for the format will tell you why and for what you need the
";"

in your case the format give you trobles, because you are not allowed
to use a Null_Value. The fourth ";" is the format for the Null-Value.

Now you have to decide what to do, if this form field is Null, use a
date for no-Input, or use now() as an input.

like:
if isnull(me.txtTransactionDate) then
.Fields("TransactionDate") =now()
' .Fields("TransactionDate") =#1/1/1900#

else
.Fields("TransactionDate")
=Format(Me.txtTransactionDate,"\#mm\/dd\/yyyy\ hh\:nn\:ss\#")
endif


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW