S
s3gment
I have a report that uses an OLE object mapped to a word document that
I would like visible or not visible based on the results of a query, I
have the following code but it does not work. Basically I just want the
OLE object to be visible if the the quoteid matches the quoteid field
on the form quotes and the unit title contains *windows*server*
Function HideSBSDocument()
Dim strQueryName As String
strQueryName = "SELECT Products.[Unit Title], [Quote Details].QuoteID "
strQueryName = strQueryName & "FROM Products INNER JOIN [Quote Details]
ON Products.ProductID = [Quote Details].ProductID "
strQueryName = strQueryName & "WHERE (((Products.[Unit Title]) Like
'*windows*server*') AND (([Quote Details].QuoteID) Like
[Form]![Quotes]![QuoteID]));"
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset(strQueryName)
strUnitTitle = rs![Unit Title]
If strUnitTitle <> "" Then
OLESBSDocument.Visible = True
Else
If strUnitTitle = "" Then
OLESBSDocument.Visible = False
End If
End If
rs.Close
db.Close
End Function
I would like visible or not visible based on the results of a query, I
have the following code but it does not work. Basically I just want the
OLE object to be visible if the the quoteid matches the quoteid field
on the form quotes and the unit title contains *windows*server*
Function HideSBSDocument()
Dim strQueryName As String
strQueryName = "SELECT Products.[Unit Title], [Quote Details].QuoteID "
strQueryName = strQueryName & "FROM Products INNER JOIN [Quote Details]
ON Products.ProductID = [Quote Details].ProductID "
strQueryName = strQueryName & "WHERE (((Products.[Unit Title]) Like
'*windows*server*') AND (([Quote Details].QuoteID) Like
[Form]![Quotes]![QuoteID]));"
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset(strQueryName)
strUnitTitle = rs![Unit Title]
If strUnitTitle <> "" Then
OLESBSDocument.Visible = True
Else
If strUnitTitle = "" Then
OLESBSDocument.Visible = False
End If
End If
rs.Close
db.Close
End Function