Date Problems

S

Sam

Hi!
I have the current date (via "Date()") in the Control
Source field of my OrderDate text box on my form. How
would I go about making sure that the current date the
order was ordered on (ie: today or yesterday or
whatnot) 'shows up' in the order table properly? If I bind
the OrderDate field to the table's OrderDate column, I
don't get any date on my form... I don't mind if it's a
code, since I wsa thinking it might need something in the
BeforeUpdate field, but I don't know much about the
coding. Thanks for your help!
sam
 
S

SFAxess

I would suggest putting Date() into the Default Value
property for the OrderDate control. For the Control
Source, enter/select the name of the column you want the
data written to in the table i.e. OrderDate
 
S

sam

Hrm... That seems to be just putting in an empty space.
Since the OrderDate column is blank becuase I want the
current date to be put in there *from* the form (or the
User settings, I don't care which...
sam
 
S

SFAxess

Hmmm...
If you added Date() to the "Default Value" property then
you should see the current system date when you start or
are on a NEW record.
If you want the date added after you add OR edit a record
in the form, you need to add code like this to the
AfterUpdate or BeforeUpdate event of the Form:
me.OrderDate=Date()

The above code will erase whatever is currently in the
OrderDate textbox and enter the current date.
 

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