Solved

date field

Posted on 2002-07-18
15
252 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to draw animated progressbar in Tvirtualstringtree 5 115
proper way to parse text with delphi 7 100
delphi exception 7 61
how can i search if string exist in array ? 3 49
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

16 Experts available now in Live!

Get 1:1 Help Now