Why Can I No Longer Save a Record?

G

Guest

I have a simple flat file table that tracks my Time & Attendance at work. All
of the values in each field are default values such as Date(), Start_Time,
End_Time, etc. or calculated values such as End_Time minus _Start Time. They
are activated by clicking on the New Record button. The only field where I
actually entered data was the week of the year.

I finally realized there is a week function so I created the following
default expression.
=Format([Date_Work],"ww")

It works perfectly, so now I don't have to do anything other than click on
the New Record button. All of the data is entered correctly. However, I can
no longer save the record. Why? The only way to save a new record is to move
to the Note field and type something in there, then the SAVE button works.

Can someone please explain why this is happening?

Thanks,
Robert
 
D

Dirk Goldgar

Robert T said:
I have a simple flat file table that tracks my Time & Attendance at
work. All of the values in each field are default values such as
Date(), Start_Time, End_Time, etc. or calculated values such as
End_Time minus _Start Time. They are activated by clicking on the New
Record button. The only field where I actually entered data was the
week of the year.

I finally realized there is a week function so I created the following
default expression.
=Format([Date_Work],"ww")

It works perfectly, so now I don't have to do anything other than
click on the New Record button. All of the data is entered correctly.
However, I can no longer save the record. Why? The only way to save a
new record is to move to the Note field and type something in there,
then the SAVE button works.

Can someone please explain why this is happening?

A record won't be saved unless it is "dirty"; that is, it has data that
has been modified. Since all your fields are getting their values by
default, the record isn't dirty and won't be saved.

You could force the record to be flagged as dirty by setting the focus
to a one of the bound controls and setting the form's Dirty property to
True; e.g.,

Private Sub cmdSave_Click()

Me!WorkWeek.SetFocus
Me.Dirty = True

End Sub

Or you could set one of the bound controls' values equal to itself.
 

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