Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-18
10
Medium Priority
?
332 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

721 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