I recieve the following error when I leave the Grade.SetFocus in my code...
Microsoft Access can't move the focus to the control Grade
GRADE.SetFocus - Highlighted when I hit debug on the error message
Expand|Select|Wrap|Line Numbers
- Private Sub C_Click()
- GRADE.SetFocus
- If GRADE.Text = "" Then
- MsgBox "Please select a grade."
- C.Locked = True
- ElseIf GRADE.Text = Not Null Then
- Else
- C.Locked = False
- C.SetFocus
- End If
- End Sub
- Private Sub C_Exit(Cancel As Integer)
- GRADE.SetFocus
- C.Locked = False
- If Trim(GRADE.Text) = "1006" Then
- If C.Value < 0.04 Or C.Value > 0.06 Then
- MsgBox "Value must be between 0.04 and 0.06"
- C.SetFocus
- End If
- MN.SetFocus
- End If
- End Sub
When I remove Grade.SetFocus from my code, I get...
You can't reference a property or a method for a control unless the control has the focus
If GRADE.Text = "" Then - Highlighted when I hit debug on the error message
Expand|Select|Wrap|Line Numbers
- Private Sub C_Click()
- If GRADE.Text = "" Then
- MsgBox "Please select a grade."
- C.Locked = True
- ElseIf GRADE.Text = Not Null Then
- Else
- C.Locked = False
- C.SetFocus
- End If
- End Sub
- Private Sub C_Exit(Cancel As Integer)
- GRADE.SetFocus
- C.Locked = False
- If Trim(GRADE.Text) = "1006" Then
- If C.Value < 0.04 Or C.Value > 0.06 Then
- MsgBox "Value must be between 0.04 and 0.06"
- C.SetFocus
- End If
- MN.SetFocus
- End If
- End Sub
Any help would be greatly appreciated.