I have a report in which I would like to display "Yes" if a certain entry exists in a query table. I am using an If loop as shown below. I am getting an error at the line If qryTempData.EPCStatusDesc = Dock Door. EPCStatusDesc is a field in the query table. How can i get "Yes" to be printed if the text "Dock Door" exists in the Query Table?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
Dim strSQL As String
Set MyDB = CurrentDb()
strSQL = "Select EPCStatusDesc from qryItemData Where EPCStatusDesc = 'Dock Door'"
Set qdef = MyDB.CreateQueryDef("qryTempData", strSQL)
If qryTempData.EPCStatusDesc = Dock Door Then
Text19.Value = "Yes"
Else
Text19.Value = "No"
End If
End Sub
Thanks.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
Dim strSQL As String
Set MyDB = CurrentDb()
strSQL = "Select EPCStatusDesc from qryItemData Where EPCStatusDesc = 'Dock Door'"
Set qdef = MyDB.CreateQueryDef("qryTempData", strSQL)
If qryTempData.EPCStatusDesc = Dock Door Then
Text19.Value = "Yes"
Else
Text19.Value = "No"
End If
End Sub
Thanks.