Nested If with error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I get an Object Required error when I attempt to run this command from a
button on a subform.

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Me!DateAssigned = Date


If frmtardyadd.subTardyCounter.Tardies = 8 Then
Me!Step1 = True
ElseIf frmtardyadd.subTardyCounter.Tardies = 11 Then
Me!Step2 = True
End If

DoCmd.RunCommand acCmdSaveRecord


End Sub


I just added the If statements. They are supposed to read the value from a
field in a subform and then, if it is equal to a certain number, set a step1
or step2 value to yes.

I am running this from a different subform,subDhallAdd and am sure I have
the wording incorrect, but I can't figure out what to do. If Access could
just read my mind.

Could someone help me with the proper wording please.
 
suggest you step through the code to see what line triggers the error, and
post back with that info.

hth
 
Ripper said:
I get an Object Required error when I attempt to run this command from a
button on a subform.

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Me!DateAssigned = Date


If frmtardyadd.subTardyCounter.Tardies = 8 Then
Me!Step1 = True
ElseIf frmtardyadd.subTardyCounter.Tardies = 11 Then
Me!Step2 = True
End If

DoCmd.RunCommand acCmdSaveRecord


End Sub


I just added the If statements. They are supposed to read the value from
a
field in a subform and then, if it is equal to a certain number, set a
step1
or step2 value to yes.

I am running this from a different subform,subDhallAdd and am sure I have
the wording incorrect, but I can't figure out what to do. If Access could
just read my mind.

Could someone help me with the proper wording please.

If frmtardyadd.subTardyCounter is a subform control (as I suspect from the
name), try:

If frmtardyadd.subTardyCounter.Form.Tardies = 8 Then
 
Back
Top