Default on Bound text Box

Edgarr8

BienChingon!
Local time
Today, 13:48
Joined
May 29, 2009
Messages
69
Hi guys,

I am trying to set a default date on a text box that is bound to a table.

Is there any way I can get that to defaul to todays Date if its blank?

i tried setting the defauls in the default value in properties but it comes back blank.
 
With your table in design view put Date() in the Default Value row.
 
You can do the same thing at form level. However bear in mind that the Default Value will not populate existing blank records and will only populate new records.
 
oh, I get it, so my question would be how can i populate and existing blank record with a default date?
 
To populate existing records with a date use an update query

For example

SELECT Sample.OrderDate
FROM Sample
WHERE (((Sample.OrderDate) Is Null));

You don't want to overwrite existing dates.
 
To populate existing records with a date use an update query

For example

SELECT Sample.OrderDate
FROM Sample
WHERE (((Sample.OrderDate) Is Null));

You don't want to overwrite existing dates.

Almost there:

UPDATE YourTableNameHere SET YourFieldNameHere = Date()
WHERE (((YourFieldNameHere) Is Null));
 
Whoops!! I knew that but just copied the wrong SQL.

Just change the date to something that may be more meaningful but how do you know when the record was created?
 

Users who are viewing this thread

Back
Top Bottom