date

I

Imarko

when I open the form I want to have today date on my date field but just if
it is a new lient not on the previous one that already collect information
about
 
S

Stuart McCall

Imarko said:
when I open the form I want to have today date on my date field but just
if
it is a new lient not on the previous one that already collect information
about

Try this in the form's OnCurrent event:

If Me.NewRecord Then
Me.MyDateField = Date
End If

(substitute MyDateField with your date control's name)
 
R

Rick Brandt

Imarko said:
when I open the form I want to have today date on my date field but
just if it is a new lient not on the previous one that already
collect information about

Enter Date() as the default value property for that control.
 
M

Marshall Barton

Stuart said:
Try this in the form's OnCurrent event:

If Me.NewRecord Then
Me.MyDateField = Date
End If


This is not a good idea because it dirties the new record
before the user enter starts to enter data. Then the user
must undo the record when s/he decides not to create a new
record.

The BeforeInsert event is the earliest safe event that can
be used, but then users can not see the date until data
entry begins.
 
S

Stuart McCall

Marshall Barton said:
This is not a good idea because it dirties the new record
before the user enter starts to enter data. Then the user
must undo the record when s/he decides not to create a new
record.

The BeforeInsert event is the earliest safe event that can
be used, but then users can not see the date until data
entry begins.

Right you are. Thanks for the correction.
 
L

Linq Adams via AccessMonster.com

So, Marsh, you're saying that unlike the rest of the Access developing
community, you never use default values?
 
M

Marshall Barton

I think your newsreader has mangled this thread.

From where I sit, you replied to Rick after he suggested
using DefaultValue.

Else thread I replied to Stuart why assigning the Value in
the Current event is not a good idea. I assumed it went
without saying that Rick's approach was the preferred
method.

Given my view of this thread, I really don't understand
where your question is coming from.
 

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