View Single Post
  #10  
Old December 23rd, 2004, 01:40 PM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Doug :-)

Assuming TransactionDate is a Date-type field, you need to enclose the

date
in # characters (or else use the CDate function)

.Fields("TransactionDate") = Format(Me.txtTransactionDate,
"\#mm\/dd\/yyyy\#;;;\N\u\l\l")

or

.Fields("TransactionDate") = CDate(Me.txtTransactionDate)

(See http://www.mvps.org/access/datetime/date0005.htm at "The Access Web"
for other formats to use if TransactionDate contains time as well as the
date)


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.

Jan


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



"Jan Il" wrote in message
...
Hi Andi :-)

On Wed, 22 Dec 2004 14:00:54 -0500, "Jan Il"
wrote:

have you missed that?

the error is he
your table needs the TransactionDate set to a Value,
because addnew adds this field with a Null Value

.Fields("TransactionDate") = me.TransactionDate


.Update


I added the above to the existing code in the Transaction control

NotInList
event code, in the area where it appears it should go, and I am now

getting
a type mismatch error: Here is what I added and where in the code:

With rst
.AddNew
.Fields("Transaction") = NewData
.Fields("TransactionDate") = Me.txtTransactionDate
.Update

The txtTransactionDate is the name of the control on the form. It does
compile alright, but, when I click OK on the Add box, the error message

is
fired. Sorry to be so dense, but, obviously I'm not doing it right.

Thank you.

Jan



If you expect an answer to a personal mail, add the word "manfred" to

the
first 10 lines in the message
MW