I recently added a code to highlight in red the text box that the user did not fill out. I also added a code that would alert them with a message box. I have this dcount code but when i press the run button to execute the query i get a "Data type mismatch in criteria expression" whenever the user leaves the textbox blank. Can you help me with my code? Im getting an error on line:
If DCount("*", "Final - Union Query 07 & 08") > 0 Then
Private Sub Command2_Click()
If DCount("*", "Final - Union Query 07 & 08") > 0 Then
Me!results.Requery
ElseIf IsNull(Me.master_bill_a.Value) Or (Me.master_bill_a.Value = "")
Then
MsgBox ("All criteria must be filled in the form")
Me.master_bill_a.BorderColor = vbRed
DoCmd.GoToControl "master_bill_a"
ElseIf IsNull(Me.cash_date_a.Value) Or (Me.cash_date_a.Value = "") Then
MsgBox ("All criteria must be filled in the form")
Me.cash_date_a.BorderColor = vbRed
DoCmd.GoToControl "cash_date_a"
ElseIf IsNull(Me.billing_date_s) Then
MsgBox ("All criteria must be filled in the form")
Me.billing_date_s.BorderColor = vbRed
DoCmd.GoToControl "billing_date_s"
Else
MsgBox ("There are no results to display. This may be an overpayment or
the wrong information was entered in the form.")
End If
End Sub
你需要为那个奇怪的表名加括号:
If DCount("*", "[Final - Union Query 07 & 08]") > 0 Then
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.