I’m working with the follwing text boxes on a data entry form.
LA Code
Date Prepped
Box Completed (Yes/No field)
Date_Completed
Date_Incomplete
The Date_Completed and Date_Incomplete text boxes are set to invisible until Yes or No has been select in the Box Completed drop down text box. If yes or no has been selected Date_Completed or Date_Incomplete text boxes will appear, at which point when either date has been entered, that completes all the data entry.
After all data has been entered, the add record button is click to add the data to the table. However, upon clicking the add button, a message appears stating the following: Microsoft Access can’t move the focus to control Date_Incomplete. Same thing occurs when selection No except for the message will say can’t move the focus to control Date_Completed.
I am also getting the same message with all the other text boxes. However those problems were resolved when placing the setfocus code right above each text box . For some reason when placing setfocus code above Date_Completed and Date_Incomplete, I get the can’t move the focus to control message when clicking the add record button Does anyone have knowledge of how to resolve this setfocus issue?
The following is the actual code I’m working with.
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
LA_Code.SetFocus
If Me.LA_Code.Text = "" Then
MsgBox "Please an LA Code", vbInformation
LA_Code.SetFocus
Exit Sub
End If
Date_Prepped.SetFocus
If Me.Date_Prepped.Text = "" Then
MsgBox "Enter Date Prepped", vbInformation
Exit Sub
End If
Completed_Box.SetFocus
If Me.Completed_Box.Text = "" Then
MsgBox "Select Yes or No", vbInformation
Exit Sub
End If
Me.Date_Completed.SetFocus
If Me.Date_Completed.Text = "" Then
MsgBox "Enter a completed date", vbInformation
Exit Sub
End If
Me.Date_Incomplete.SetFocus
If Me.Date_Incomplete.Text = "" Then
MsgBox "Enter a Incompleted date", vbInformation
Exit Sub
End If
DoCmd.GoToRecord , , acNewRec
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
LA Code
Date Prepped
Box Completed (Yes/No field)
Date_Completed
Date_Incomplete
The Date_Completed and Date_Incomplete text boxes are set to invisible until Yes or No has been select in the Box Completed drop down text box. If yes or no has been selected Date_Completed or Date_Incomplete text boxes will appear, at which point when either date has been entered, that completes all the data entry.
After all data has been entered, the add record button is click to add the data to the table. However, upon clicking the add button, a message appears stating the following: Microsoft Access can’t move the focus to control Date_Incomplete. Same thing occurs when selection No except for the message will say can’t move the focus to control Date_Completed.
I am also getting the same message with all the other text boxes. However those problems were resolved when placing the setfocus code right above each text box . For some reason when placing setfocus code above Date_Completed and Date_Incomplete, I get the can’t move the focus to control message when clicking the add record button Does anyone have knowledge of how to resolve this setfocus issue?
The following is the actual code I’m working with.
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
LA_Code.SetFocus
If Me.LA_Code.Text = "" Then
MsgBox "Please an LA Code", vbInformation
LA_Code.SetFocus
Exit Sub
End If
Date_Prepped.SetFocus
If Me.Date_Prepped.Text = "" Then
MsgBox "Enter Date Prepped", vbInformation
Exit Sub
End If
Completed_Box.SetFocus
If Me.Completed_Box.Text = "" Then
MsgBox "Select Yes or No", vbInformation
Exit Sub
End If
Me.Date_Completed.SetFocus
If Me.Date_Completed.Text = "" Then
MsgBox "Enter a completed date", vbInformation
Exit Sub
End If
Me.Date_Incomplete.SetFocus
If Me.Date_Incomplete.Text = "" Then
MsgBox "Enter a Incompleted date", vbInformation
Exit Sub
End If
DoCmd.GoToRecord , , acNewRec
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub