Editing a textbox with a smalldatetime control source shows date and time

W

Wes Peters

How can I change the format of a textbox that has a smalldatetime control
source so that only the date appears when it needs to be edited? Currently
both the date AND time show up.

Thanks,
Wes
 
S

Sylvain Lafontaine

The time must be set to zero; otherwise it will show up.

If you want to keep a time part different from zero, then you need to use 2
fields (one for the date, the other for the time) or use unbound fields and
manipulate them in the OnCurrent and OnBeforeUpdate events.

S. L.
 
W

Wes Peters

OK, Thanks. I see how that works now.

I have a field that has a default value of getdate(). All I want is the
date portion. Is there any way to capture just the date portion if the
default value is used?

Thanks
 
S

Sylvain Lafontaine

Yes, use something like:

Convert (char (10), getdate(), 102)

or: Convert (DateTime, Convert (char (10), getdate(), 102))

S. L.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top