Nested If with error

R

Ripper

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.
 
T

tina

suggest you step through the code to see what line triggers the error, and
post back with that info.

hth
 
S

Stuart McCall

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
 

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