=Date() not found

K

Key

This is really doing my head in...

I have a field named 'lastupdate' which I need to display the current date
when a record is updated on my form 'clientDatabase'.

I have allready searched this site and everyone says to put some code in the
beforeupdate box of the form which displays the customer data. 'main_screen'

I have done the following:


Private Sub Form_BeforeUpdate(Cancel As Integer)

On Error GoTo BeforeUpdate_Err

' Set bound controls to system date
lastupdate = Date

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

When I have entered the "lastinput = date()" ithe VBeditor removes the "()".

The problem is this....
when i have updated a record and click to go to next record I get the message
"cant find the field "date" referred to in your expression"

what am I doing wrong :-(

Any help would be very much appreciated

Regards
Key
 
D

Douglas J. Steele

Two common reasons.

The first is that you've used Date somewhere else in your database: a field
in a table, a control on a form, or something like that. Date is a reserved
word, and should never be used in anything you created in the database.

The other possibility is that your references are messed up.

References problems can be caused by differences in either the location or
file version of certain files between the machine where the application was
developed, and where it's being run (or the file missing completely from the
target machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open a code module and select
Tools | References from the menu bar

Examine all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
 
K

Key

Hi Douglas,
thanks for getting back so quick.

I have not used "date" elsewhere as a variable and have no missing
references as far as I can see.

I have used date() in the linked table as the default value and this works
as when I click the "new entry" button it automatically puts todays date into
the "lastupdate" box on the form.

I have also opened the file on another computer and get the same error
message.

Key
 
J

John Spencer

Just for grins try

Me.LastUpdate = VBA.Date()

See if that works.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
J

John Spencer

Ok, that means you either have a references issue (re Doug Steele's
posting) or you have an object someplace in your database named Date.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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