Conditional Display of Text Box

G

Guest

I have a Text Box called [Required Product Reference] and I only want it to
be visible including border if the Tbl_Hotels.Brand = "CX". The SQL is
below. Any help is appreciated.


SELECT Tbl_PIP.InspectionID, Tbl_PIP.[Hotel ID], Tbl_PIP.Date, Tbl_PIP.Need,
Tbl_PIP.Item, Tbl_PIP.Category, Tbl_PIP.Location, Tbl_PIP.[D-C Reference],
Tbl_PIP.Comment, IIf([Need]=True,True,"") AS Need2, Tbl_PIP.Phase,
Tbl_PIP.PIPID, Tbl_PIP.[Top Priority], Tbl_PIP.[Required Product Reference],
Tbl_PIP.Commodity, Tbl_Hotels.Brand, Tbl_PIP.[D-C Reference]
FROM Tbl_Hotels INNER JOIN Tbl_PIP ON Tbl_Hotels.ID = Tbl_PIP.[Hotel ID]
WHERE (((Tbl_PIP.Item) Is Not Null) AND
((Tbl_PIP.Category)=[Forms]![Frm_PIP_Inspection]![cbo_Area]) AND
((Tbl_PIP.Location)=[Forms]![Frm_PIP_Inspection]![cbo_Location]) AND
((IIf([Need]=True,True,"")) Like
[Forms]![Frm_PIP_Inspection]![Frm_PIP_Inspection_Subform].[Form]![Text25] &
"*"))
ORDER BY Tbl_PIP.Commodity, Tbl_PIP.Commodity;
 
G

Guest

Chris,

If Tbl_Hotels.Brand is in the RecordSource underlying your form, place the
following code in its AfterUpdate event:

If Me![Tbl_Hotels.Brand] = "CX" Then
Me![Required Product Reference].Visible = True
Else
Me![Required Product Reference].Visible = False
End If

The code further assumes that the control displaying the Brand has a *value*
of "CX" and is not *displaying* a text value but is actually bound to a
numeric field.

Place the code in the form's OnCurrent event as well so that as you move to
a new record, the visibility is toggled based on the current value of the
brand.

Hope that helps.
Sprinks
 
G

Guest

Sprinks,

I tried the code you gave me and the following error returned:

Run-time error '438':

Object doesn't support this property or method


Sprinks said:
Chris,

If Tbl_Hotels.Brand is in the RecordSource underlying your form, place the
following code in its AfterUpdate event:

If Me![Tbl_Hotels.Brand] = "CX" Then
Me![Required Product Reference].Visible = True
Else
Me![Required Product Reference].Visible = False
End If

The code further assumes that the control displaying the Brand has a *value*
of "CX" and is not *displaying* a text value but is actually bound to a
numeric field.

Place the code in the form's OnCurrent event as well so that as you move to
a new record, the visibility is toggled based on the current value of the
brand.

Hope that helps.
Sprinks

Chris said:
I have a Text Box called [Required Product Reference] and I only want it to
be visible including border if the Tbl_Hotels.Brand = "CX". The SQL is
below. Any help is appreciated.


SELECT Tbl_PIP.InspectionID, Tbl_PIP.[Hotel ID], Tbl_PIP.Date, Tbl_PIP.Need,
Tbl_PIP.Item, Tbl_PIP.Category, Tbl_PIP.Location, Tbl_PIP.[D-C Reference],
Tbl_PIP.Comment, IIf([Need]=True,True,"") AS Need2, Tbl_PIP.Phase,
Tbl_PIP.PIPID, Tbl_PIP.[Top Priority], Tbl_PIP.[Required Product Reference],
Tbl_PIP.Commodity, Tbl_Hotels.Brand, Tbl_PIP.[D-C Reference]
FROM Tbl_Hotels INNER JOIN Tbl_PIP ON Tbl_Hotels.ID = Tbl_PIP.[Hotel ID]
WHERE (((Tbl_PIP.Item) Is Not Null) AND
((Tbl_PIP.Category)=[Forms]![Frm_PIP_Inspection]![cbo_Area]) AND
((Tbl_PIP.Location)=[Forms]![Frm_PIP_Inspection]![cbo_Location]) AND
((IIf([Need]=True,True,"")) Like
[Forms]![Frm_PIP_Inspection]![Frm_PIP_Inspection_Subform].[Form]![Text25] &
"*"))
ORDER BY Tbl_PIP.Commodity, Tbl_PIP.Commodity;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sorting a Form 1

Top