Default Value problem

M

Mixer1

Feel a bit silly.

I want to insert a =Now() Date field on every new record created via a
certain form. I don't want people seeing this info.

So, I added AphaDate Date field to the table the query for this form is
based on. I insert the field on the form and mark it hidden. In the
properties for this field on the form, I say the default value =Now()

I assume then that any new record created will "stamp" with this date. But
it doesn't work When I create the table, add the field to the query and try
to set this up, the field shows up as blank no matter what I do.

What am I missing??

Thanks
 
K

Ken Snell \(MVP\)

It sounds as if you have done the right things. Note that this date/time
value will be inserted ONLY when a new record is created, not for any
existing records. Are you actually creating new records via the form? Or is
the form just seeing the record after it's been created?

Did you bind the hidden control to the AphaDate field on the form (set the
ControlSource to the AphaDate field)?

Do you have a field or control named Now anywhere in the table or on the
form?

I prefer putting the =Now() in the Default Value property of the field in
the design view of the table, instead of using the control's Default View
property. if you do it in the table, then you don't need to worry about it
getting a value should you enter a new record via the table instead of the
form.
 
D

Dale Fye

The other advantage of doing it in the table is if you insert are record
using SQL, it will get the date added, but if you use the controls default
value, and insert the record using SQL, it won't.

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
M

Mixer1

Bingo Ken. The record is actually created on a previous form and this form
has more detail information that is only accessible AFTER the record is
created. Duh!
I just did it here because there's more real estate to place a hidden view
so that anyone else who ever works on this design will see what's going on
easier.

But the form where the record is actually created, that's a continuous form.
That won;t be a problem if I place the field on that and hide it?
 
K

Ken Snell \(MVP\)

Place the invisible box anywhere within the record (Detail section for a
continuous form). Note that you can extend the width of the form and put the
invisible textbox off to the right side, out of the way of the other
controls.

--

Ken Snell
<MS ACCESS MVP>


Mixer1 said:
Bingo Ken. The record is actually created on a previous form and this
form
has more detail information that is only accessible AFTER the record is
created. Duh!
I just did it here because there's more real estate to place a hidden view
so that anyone else who ever works on this design will see what's going on
easier.

But the form where the record is actually created, that's a continuous
form.
That won;t be a problem if I place the field on that and hide it?

< snipped >
 
K

Ken Snell \(MVP\)

Dale Fye said:
The other advantage of doing it in the table is if you insert are record
using SQL, it will get the date added, but if you use the controls default
value, and insert the record using SQL, it won't.

I concur; thanks for the added info, Dale.
 

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