Stafford
Registered User.
- Local time
- Today, 09:09
- Joined
- Aug 20, 2002
- Messages
- 23
I've grabbed some code in these forums and have been trying to get this one to work to my liking.
I have a form with a combo box and a txt box, I need values in both before the record is added.
Here is the code I've used to check for values
Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click
cmbBranchNumber.SetFocus
If cmbBranchNumber.Text = "" Then
txtTicketNumber.SetFocus
If txtTicketNumber.Text = "" Then
MsgBox "Please make sure you have entered all information!"
cmbBranchNumber.SetFocus
If cmbBranchNumber.Text = "'" Then
txtTicketNumber.SetFocus
If txtTicketNumber.Text = "" Then
MsgBox "Please enter ticket Number!"
End If
End If
End If
End If
DoCmd.GoToRecord , , acNewRec
Exit_cmdAddRecord_Click:
Exit Sub
Err_cmdAddRecord_Click:
MsgBox Err.Description
Resume Exit_cmdAddRecord_Click
End Sub
What I want this code to do is to check to see if values have been entered into either box.
As it is now, if I enter a value into at least one box, the record is added. How can I check to make sure values have been entered into both?
I have a form with a combo box and a txt box, I need values in both before the record is added.
Here is the code I've used to check for values
Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click
cmbBranchNumber.SetFocus
If cmbBranchNumber.Text = "" Then
txtTicketNumber.SetFocus
If txtTicketNumber.Text = "" Then
MsgBox "Please make sure you have entered all information!"
cmbBranchNumber.SetFocus
If cmbBranchNumber.Text = "'" Then
txtTicketNumber.SetFocus
If txtTicketNumber.Text = "" Then
MsgBox "Please enter ticket Number!"
End If
End If
End If
End If
DoCmd.GoToRecord , , acNewRec
Exit_cmdAddRecord_Click:
Exit Sub
Err_cmdAddRecord_Click:
MsgBox Err.Description
Resume Exit_cmdAddRecord_Click
End Sub
What I want this code to do is to check to see if values have been entered into either box.
As it is now, if I enter a value into at least one box, the record is added. How can I check to make sure values have been entered into both?