On Click - Error 424 Object Required

try:

Me![Ref1Date].Value = VBA.Date


also if you have time, replace all occurrence of Error.Description to Err.Description from all your forms.
 
Last edited:
try:

Me![Ref1Date].Value = VBA.Date


also if you have time, replace all occurrence of Error.Description to Err.Description from all your forms.
I've been playing with the db and so far I have not been able to use Date() in vba without creating an error.
However, the following seems to work:
Me.Ref1Date = Format(Now, "mm/dd/yyyy")

EDIT:
I am begging to suspect that something in the db is corrupt.
 
Both the above codes work, thanks both for your help.

My concern is what's causing this one form to not accept the same VB code as all other forms.

As a test I've just created a blank form in the database, added just a button and a Ref1Date textbox, added the original On Click code but when I click on the button nothing happens, not even an error message.

Soooooo confused!
 
As Bob says this sounds like possible corruption.
I would create a new empty database and import all your existing objects into it.

Then make sure every code module has the Option Explicit at the top, and try compiling it all again.
 
As Bob says this sounds like possible corruption.
I would create a new empty database and import all your existing objects into it.

Then make sure every code module has the Option Explicit at the top, and try compiling it all again.

Just tried that and in the new db I'm getting error messages ("You can't assign a value to this object") when clicking the button on other forms now too.
 
I have the following code in a module and I can't remember why it's there. The "cmd" on line one is puzzling me as it doesn't appear in any of the opther On Click event codes. Can anyone explain this to me please? (sorry for being thick!!!!)

Code:
Private Sub cmdAddToday1_Click()
On Error GoTo ErrorAddToday
     Me.DocDate = Date
 ExitAddToday:
    Exit Sub
 ErrorAddToday:
    MsgBox Error.Description
    Resume ExitAddToday
End Sub
 
cmdAddtoday1 is a control name (Proabably a command button ) that was or is on a form.

It's good naming practice to call things something obvious, so I generally call all buttons on forms cmdDoSomething. The cmd at the beginning reminds me when looking through code later that its code attached to a command button.

To be honest although it's deemed good practice to include error handlers in all your code, don't put them in or enable them until you are finishing off designs. That way you will see what isn't working and be able to debug it.
 
xyba,
The database you posted has no data. Can you give us a copy with a few records so we have some context?
Some instructions to recreate the error would also be helpful.
From my view, we are guessing at what to do and when to do it?

As for hidden tables and error handling-- I would not make anything hidden and I would have error handling on everything. Once the database and application have been thoroughly tested, then do your hidden tables if necessary.

I also suggest you make good use of Debug.Print statement and step debugging to ensure things are working as expected.

Finally, I would encourage you to Normalize your tables in order to take full advantage of the features of relational database/Access.

Good luck.
 

Users who are viewing this thread

Back
Top Bottom