Solved

Master/Slave Tables in Delphi 7 using MSAccess DBs result in "not a valid timestamp" error/exception

Posted on 2004-08-18
10
321 Views
Last Modified: 2010-04-05
I have converted a Delphi 5 program to Delphi 7 which uses two MS Access tables, a master and a slave.  Each has a datetime field in the primary key, which correspond.

When I to a TTable.Insert on Table 1 (master), I get an exception "0.0 is not a valid timestamp".  The error occurs because Table 2 (slave) uses the datetime field in its master/slave key specifications.  I know this because if I unlink the two tables and do an insert on each of them, I get no error.

     TblTrustReq1.Open;
     TblTrustReq2.Open;
     TblTrustReq1.Append;
     TblTrustReq1CHKRequesterID.Value := 'KG';
     TblTrustReq1CHKRequesterDate.Value := Now;
     TblTrustReq1CHKCheckDate.Value := Now;

     TblTrustReq2.Append;
     TblTrustReq2CHKRequesterID2.Value := TblTrustReq1CHKRequesterID.Value;
     TblTrustReq2CHKDate.Value := TblTrustReq1CHKRequesterDate.Value;
     TblTrustReq2CHKSequence.Value := 1;

Can anyone help?

Keith
0
Comment
Question by:Kgondron
10 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11832215
You're appending but not posting the changes. Any reasons why? Or did you forget to cut that part of the code. :)
0
 

Author Comment

by:Kgondron
ID: 11832325
That comes later.  First I have to fill in other fields.  This bombs out immediately on doing the TblTrustReq1.Append;
KG
0
 

Author Comment

by:Kgondron
ID: 11832639
Forget to mention:  I am using Reggatta's Titan for Access components to access the MS Access databases.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 11835825
Your problem is that the function Now returns a TDateTime result whereas (judging from your error message) a Timestamp value is expected.

Use the following:
TblTrustReq1CHKRequesterDate.Value := DateTimeToTimeStamp(Now);
TblTrustReq1CHKCheckDate.Value := DateTimeToTimeStamp(Now);

The above assumes your Regatta component want a TTimestamp value.

If the above still doesn't work, your component probably doesn't support the delphi datatypes in which case you would have to convert your datetime value to an access date data type.

Kind regards
Pierre Cornelius
0
 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 11835850
Just another thought:

Try this:
TblTrustReq1CHKRequesterDate.AsDateTime := Now;
TblTrustReq1CHKCheckDate.AsDateTime := Now;

Regards
Pierre

0
 
LVL 6

Expert Comment

by:bpana
ID: 11839146
you should post the changes on the first table before starting to modify the second one.

  TblTrustReq1CHKCheckDate.Value := Now;
  TblTrustReq1CHKCheckDate.Post;
...

but if you say that this line gives the error:
  TblTrustReq1.Append;
that should be something else.
0
 

Author Comment

by:Kgondron
ID: 13345684
Nice try, guys, it's been so long ago that I got around this problem, it was hard to remember how it was solved.  Actually I contacted the Titan guy and he modified the Titan Access code because it had a bug in it.

Thanks anyway.
0
 

Accepted Solution

by:
PAQ_Man earned 0 total points
ID: 15015564
PAQed with points refunded (500)

PAQ_Man
Community Support Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question