Paul,
I do have another issue I discovered with this. My form also has buttons which I assume are controls. So when I run the code I end up with the message box saying "Enter all fields.". I presume this is because it's looping through the buttons as well as the text and combo boxes.
I'm not sure how to work around that.
Code:
Private Sub cmdTest_Click()
Dim billTo
Dim ctl As Control
billTo = Me.cmbBillTo.Value
For Each ctl In Me.Controls
If IsNull(ctl) Then
ctl.BackColor = &HEC2FF
End If
Next ctl
MsgBox "Enter all fields.", vbExclamation
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.BackColor = vbWhite
End Select
Next ctl
Exit Sub
If DCount("*", "qryRecordCheck") = 0 Then
DoCmd.OpenQuery "qryTempPricing"
MsgBox billTo & " has been successfully added!"
Else
If MsgBox("This record already exists. Would you like to overwrite it?", 20, "Record Exists!") = vbYes Then
DoCmd.OpenQuery "qryTempPricing"
Else
MsgBox "No change made to Pricing Table", 64, "Info"
End If
End If
End Sub
Thank you,
Nathan