Solved

date field

Posted on 2002-07-18
15
251 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 100 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now