Can't find field

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

I have a user input form which opens in in dialog mode in the AfterUpdate
event of a control. The user's selection sets the value of an option field
and the form's visible property to false. When the code resumes to evaluate
the response, I'm getting the error "Microsoft Access can't find the field
'YesOption' referred to in your expression". The option is being set as well
as the visible property. Why is Access not recognizing it?
Calling Code:
DoCmd.OpenForm "frmUpdateDeliveryInformation", acNormal, , , , acDialog

If fIsLoaded("frmUpdateDeliveryInformation") = True Then
If [Forms]![frmUpdateDeliveryInformation]![YesOption ] = True Then
'Action to take
End If
DoCmd.Close acForm, "frmUpdateDeliveryInformation"
Else
' if the form is not open, then user hit the "x", or the cancel
' button on the frmGetComboName form. Note that the cancel button on
' this form simply does a docmd.close
MsgBox "user canceled"
End If

Input Form Code:
Private Sub cmdYes_Click()
On Error GoTo Err_cmdYes_Click

Me.YesOption = True
Me.Visible = False

Exit_cmdYes_Click:
Exit Sub

Err_cmdYes_Click:
MsgBox Err.Description
Resume Exit_cmdYes_Click

End Sub
Private Sub cmdNo_Click()
On Error GoTo Err_cmdNo_Click

Me.YesOption = False
Me.Visible = False

Exit_cmdNo_Click:
Exit Sub

Err_cmdNo_Click:
MsgBox Err.Description
Resume Exit_cmdNo_Click

End Sub
Thanks!
Walter
 
In the post you have a space at the end of YesOption - [YesOption ]
If this is a copy paste of the code, you should be right if you remove that
space.

Jeanette Cunningham
 
That was it!
Thanks!
Walter

Jeanette Cunningham said:
In the post you have a space at the end of YesOption - [YesOption ]
If this is a copy paste of the code, you should be right if you remove that
space.

Jeanette Cunningham


Walter said:
I have a user input form which opens in in dialog mode in the AfterUpdate
event of a control. The user's selection sets the value of an option
field
and the form's visible property to false. When the code resumes to
evaluate
the response, I'm getting the error "Microsoft Access can't find the field
'YesOption' referred to in your expression". The option is being set as
well
as the visible property. Why is Access not recognizing it?
Calling Code:
DoCmd.OpenForm "frmUpdateDeliveryInformation", acNormal, , , , acDialog

If fIsLoaded("frmUpdateDeliveryInformation") = True Then
If [Forms]![frmUpdateDeliveryInformation]![YesOption ] = True Then
'Action to take
End If
DoCmd.Close acForm, "frmUpdateDeliveryInformation"
Else
' if the form is not open, then user hit the "x", or the cancel
' button on the frmGetComboName form. Note that the cancel button
on
' this form simply does a docmd.close
MsgBox "user canceled"
End If

Input Form Code:
Private Sub cmdYes_Click()
On Error GoTo Err_cmdYes_Click

Me.YesOption = True
Me.Visible = False

Exit_cmdYes_Click:
Exit Sub

Err_cmdYes_Click:
MsgBox Err.Description
Resume Exit_cmdYes_Click

End Sub
Private Sub cmdNo_Click()
On Error GoTo Err_cmdNo_Click

Me.YesOption = False
Me.Visible = False

Exit_cmdNo_Click:
Exit Sub

Err_cmdNo_Click:
MsgBox Err.Description
Resume Exit_cmdNo_Click

End Sub
Thanks!
Walter
 
Back
Top