RunTime Error 424 Object required

Michael J Ross

Registered User.
Local time
Today, 22:47
Joined
Mar 2, 2006
Messages
245
I have a form with subforms that are set as data Entry.

In one of the sub forms I want to do a check to ensure that data has been entered on the main form thus creating a new record before data can be entered into the subform.

In a combobox before update event I have put code in to see if the new record id which is autonumber has been created.

My code is

If Forms![MainForm]![Id] Is Null Then
MsgBox "You must enter some data on main form first"
Me.ComboMeas.Undo
End If

When I test it I get the message

Run-time error 424
Object required

When I debug it goes to the If line

Does anyone know how I can fix it?

I have tried searching it but found no suitable answer.

Cheers
 
if the combo box is on the subform, then you have to use the subform syntax to check:

If IsNull(Forms!MainForm.YourSubformControlNameHere.Form.Id)

Also, the syntax for checking if null in code like this has always forced me to use IsNull(ControlNameHere) instead of Me.ControlName = Is Null

Also, if you don't have spaces, or special characters in your object names, you don't need the brackets.
 
Also, the syntax for checking if null in code like this has always forced me to use IsNull(ControlNameHere) instead of Me.ControlName = Is Null

.

I'd completely forgot about that, that's fixed it.

Cheers! :)
 

Users who are viewing this thread

Back
Top Bottom