Adjusting button property based on another form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which displays real estate information for a building, plus a
button which opens another form with contains a photo image of the building.

I have two tables. The first is the building information and the second is
the image path information. The tables are related by the Building ID field
in both.

I would like to adjust the properties of the button on the first form, so
that it is grayed out if there is no image of the property contained on the
second form. (If there is an image associated with the record, then the
button is black and clickable.)

How do I evaluate the availability of a related record and then use it to
adjust the properties of the button control?

Thanks for your help!
 
Ken said:
I have a form which displays real estate information for a building, plus a
button which opens another form with contains a photo image of the building.

I have two tables. The first is the building information and the second is
the image path information. The tables are related by the Building ID field
in both.

I would like to adjust the properties of the button on the first form, so
that it is grayed out if there is no image of the property contained on the
second form. (If there is an image associated with the record, then the
button is black and clickable.)

How do I evaluate the availability of a related record and then use it to
adjust the properties of the button control?


Since you know th BuildingID, you can look up the record in
the other table:

if the record in the other table does not exist when there's
no picture, use
Me.button.Enabled = (DCount("*", "images", _
"BuildingID = " & Me.BuildingID)) = 0

if the record exists, but has a Null value or "" in the
picture path field, then use
Me.button.Enabled = (Nz(DLookup("path", "images", _
"BuildingID = " & Me.BuildingID), "") = "")
 
Back
Top