On Click - Error 424 Object Required

xyba

Registered User.
Local time
Today, 02:05
Joined
Jan 28, 2016
Messages
189
In a split form in my db when clicking any button I keep getting the 424 runtime error and can't figure out why. The split form was copied and pasted from another one so not sure if that is the issue, though I have copied and pasted others with no issue.

The debugger shows the below with the "MsgBox Error.Description" statement highlighted in yellow...

Code:
 Private Sub Command3204_Click()
 On Error GoTo ErrorAddToday
     Me.RefDate1 = Date
 ExitAddToday:
    Exit Sub
 ErrorAddToday:
    MsgBox Error.Description
    Resume ExitAddToday
End Sub

I can't figure this out so if anyone can help please?
 
its Err.Description, not Error.Description
 
Really? Though Error.Description is working perfectly on all buttons on all other forms. And I've just edited it to Err.Description for one of the buttons on the form I'm having a problem with and I get a new error message stating "The value you entered isn't valid for this field".
 
does the error points to your msgbox again, or does our error handler handled our error.
what is Me.Refdate1, does it has an expression as its control source?
 
does the error points to your msgbox again, or does our error handler handled our error.
what is Me.Refdate1, does it has an expression as its control source?

No, it doesn't point to the msgbox it doesn't appear to be a VB error, I think it's an Access error.

Me.Refdate1 is a date field in my table that is referenced in a textbox on the splitform where I want the button to input today's date.
 
does Refdate1 has a lookup table?
 
any Default value for the field?
 
No, there's no default value assigned.
 
Maybe back up and lets figure this out . . .
it doesn't appear to be a VB error, I think it's an Access error.
What is the exact problem at this time?
 
Maybe back up and lets figure this out . . .

What is the exact problem at this time?

I edited the code from Error.Description to Err.Description and the error message went from a VB error 424 to an access error message stating "The value you entered isn't valid for this field".
 
Please make sure that at the top of your module you see these two lines of code. . .
Code:
Option Compare Database
Option Explicit
. . . and if you don't see Option Explicit, add it and compile your file. To compile, go to a Code Window's Main Menu -> Debug -> Compile project

Then, please post all the relevant code, and indicate at what line the error occurs, and I'm sure we can get to the bottom of things.
 
Please make sure that at the top of your module you see these two lines of code. . .
Code:
Option Compare Database
Option Explicit
. . . and if you don't see Option Explicit, add it and compile your file. To compile, go to a Code Window's Main Menu -> Debug -> Compile project

Then, please post all the relevant code, and indicate at what line the error occurs, and I'm sure we can get to the bottom of things.

I've added Option Explicit and compiled it but it's still not working and I still receive the 424 error.

Below is the only code I have attached to the form:

Option Compare Database
Option Explicit


Code:
Option Compare Database
Option Explicit
  
 
Private Sub Command3209_Click()
On Error GoTo ErrorAddToday
     Me.Ref1Date = Date
 ExitAddToday:
    Exit Sub
 ErrorAddToday:
    [COLOR=red][B]MsgBox Error.Description
[/B][/COLOR]   Resume ExitAddToday
End Sub
 Private Sub Form_Load()
Me.SearchBox.SetFocus
End Sub
The error is highlighting the line in red.
 
As stated in post #2 by arnelgp:

I'm confused then because Error.Description works in all my other forms. And when I alter the code to Err.Description I get a "The value you entered isn't valid for this field" error even though the textbox is set up as a date field with no default value assigned.
 
"The value you entered isn't valid for this field" This is the Err.Description from your error handler.

The other ones have probably never been called.
 
Your forms record source is a table called Documents but I can not see a table of that name
 

Users who are viewing this thread

Back
Top Bottom