Please Help!!!! Last Modified records in a form

A

AccessFitz

Hi,

I'm trying to build a text box into my form that will automatically update
to today's date when a record has changed. I have followed the online help
via this link.
http://office.microsoft.com/en-us/assistance/HA010345351033.aspx

I have place the two fields DateModified and TimeModified into my table. I
have also added these fields to the query in the recordsource of the form.
I have pasted the code into the Before Update Event property.

When I put the text fields into the form, I get this message in the text
box. #Name? in both fields. When I click on the next record, I get an
error message saying "You can not assign a value to this object?" What am I
doing wrong here?

Any input would be appreciated.

Thanks
AccessFitz
 
A

Al Camp

What are the names of the 2 fields you added to your table?
What are the names and ControlSources of the 2 fields you added to your
form?
What code are you using in the BeforeUpdate event?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
A

Al Williams

Is the Control Source for each of the text fields set to the fields in
the table? (e.g. DateModified and TimeModified?)

HTH

Al
 
A

AccessFitz

Yes the Control Source for each of the text fields is set to the fields in
the table.
 
A

AccessFitz

The two fields are DateModified and TimeModified. I used this code

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo BeforeUpdate_Err

' Set bound controls to system date and time.
DateModified = Date
TimeModified = Time()

BeforeUpdate_End:
Exit Sub


BeforeUpdate_Err:
MsgBox Err.Description, vbCritical & vbOKOnly, _
"Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
 
D

Dirk Goldgar

AccessFitz said:
Yes the Control Source for each of the text fields is set to the
fields in the table.

Pardon me, but are you sure you don't have them set to some expression,
like

="Last modified on " & [DateModified]

?

If that's not the problem, check to make sure the DateModified and
TimeModified fields appear in the field list for the form. You say you
changed the form's recordsource query, but maybe Access hasn't
recognized that. You may have to reselect the query in the form's
RecordSource property.
 
A

Al Camp

Make sure those 2 new fields are listed on your available fields for your
form. You added then to your table, now you have to make sure they have
been added to the query behind the form.
When assigning a ControlSource for any field, use the ControlSource drop
down list to make the assignment. If a field is not on that list, it's not
available to the form.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 

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