?
Solved

date field

Posted on 2002-07-18
15
Medium Priority
?
261 Views
Last Modified: 2010-04-04
I am using a dbedit for a date entry but I always get an error message that the date entered is not a valid date though it is a date. There must be something I need to declare or configure. Can somebody help me on how to handle a date field? Thanks
0
Comment
Question by:sharol
  • 4
  • 4
  • 2
  • +5
15 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 7161676
use the ongettext/onsettext events of the field

in this events use a conversion like

--ongettext
text := Field.AsString;

--onsettext
field.AsDateTime := StrToDate(text);

just from head

meikl ;-)
0
 
LVL 3

Expert Comment

by:LukA_YJK
ID: 7161687
Maybe you actually enter invalid dates. For example you enter '/' as separator, but it is '.' or you enter [month,day,year], but it must be [day,month,year]. To find all these info launch BDE Administrator and look at Configuration-System-Formats-Date. Hope it will be helpful...
0
 

Author Comment

by:sharol
ID: 7164059
Kretzschmar, I cant find the ongettext and onsettext event in the dbedit field. Are you talking anout a TDBEdit component? I cant fine the events you mentioned. Hope you could help me on this.

LukA YJK, I checked the BDE configuration and it is the way you described it to be. Is tehre anything else I can try?
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 27

Expert Comment

by:kretzschmar
ID: 7164073
>Are you talking anout a TDBEdit component?
no, i talk about the underlying tfield

-doubleclick on your dataset-object
-rightclick on the the fieldseditor
-select add all fields
-select your datefield
-assign the events in the object-inspedtor

meikl ;-)
0
 

Author Comment

by:sharol
ID: 7169888
sorry, but Im not very good in Delphi yet(just starting...). how do i assign the event? thanks.
0
 
LVL 4

Expert Comment

by:jsweby
ID: 7172831
Another common cause of the "Invalid Date/Time" error is the fact that you are entering a date in a format different to that set up in your

Control Panel --> Regional Settings --> Date

settings. This specifies the separator and the date format.

J.
0
 

Expert Comment

by:RayNorrish
ID: 7178645
Get the very usefull RXTools from (ex. http://www.torry.net/huge.htm) and drop a TDateEdit on the form.
0
 

Expert Comment

by:RayNorrish
ID: 7178648
I mean a TDBDateEdit :)
0
 

Author Comment

by:sharol
ID: 7183192
How do I use it. Pardon but Im not really good at this yet. Thanks.
0
 

Expert Comment

by:RayNorrish
ID: 7184671
You just need to drop it onto the form, there is no real difference, there is a calendar button with it which can be switched off. It is really very easy to implement.
0
 

Author Comment

by:sharol
ID: 7190079
Sorry again. So, I have downloaded the tool. What do I do next, install it as new component?
0
 

Expert Comment

by:RayNorrish
ID: 7190184
There is a readme.txt that details how to install the package(s).

You must compile the runtime packages for your version of Delphi, and place the bpl files in your search path. Then you must compile and install the design time packages.

If you don't have the install instructions, then look at this example for installing into D5..

1. Delphi 5.x:


Use "File\Open..." menu item of Delphi IDE to open RX' runtime
package RXCTL5.DPK. In "Package..." window click "Compile" button to
compile packages RXCTL5.DPK. After compiling repeat that for other RX
Library run-time packages RXDB5.DPK, RXBDE5.DPK. Put compiled BPL files
into directory that is accessible through the search PATH (i.e. DOS
"PATH" environment variable; for example, in the Windows\System directory).
After compiling RX run-time packages you must install RX design-time
packages into the IDE.

RXCTL5.DPK RXDB5.DPK RXBDE5.DPK
RXCTL5.BPL, RXDB5.BPL, RXBDE5.BPL

Use "File\Open..." menu item to open RX design-time package DCLRX5.DPK.
In "Package..." window click "Compile" button to compile the package
and then click "Install" button to register RX Library components on
the component palette. Repeat that for other RX Library design-time
packages DCLRXDB5.DPK and DCLRXBD5.DPK.
0
 
LVL 2

Expert Comment

by:ferhad
ID: 7211953
Use Simple EditBox (not dbEdit) and type this code:

Table1.FieldByName('Date').AsString:=Edit1.Text;

Time format is Day,Month,Year

Hope it will help
Regards Ferhad
0
 

Expert Comment

by:CleanupPing
ID: 9343039
sharol:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 9461258
sharol,
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to kretzschmar http:#7161676

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

anAKiN
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 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