Hello all,
So... I have a subform in continuous form view. I also have a button in the subform header that allows a second form (inspection form) to open according to the selected record in the subform. (I did not want to have a button on each "row" or record, and still don't want it ).
Here are the codes (found on internet) that I use:
Button code:
Code:
Private Sub Button_Click()
'Get the ID
Dim id_ As Integer
id_ = Me.IDInspection
'Open the new form and pass the ID to the .OpenArgs
DoCmd.OpenForm "Fm_Directives1", acNormal, , , acFormPropertySettings, acWindowNormal, id_
End Sub
Load form code:
Code:
Private Sub Form_Load()
With Me
If Not IsNull(.OpenArgs) Then
.Filter = "[IDInspection]=" & .OpenArgs
.FilterOn = True
.Caption = "IDInspection: " & .OpenArgs
End If
End With
End Sub
So far so good.
Now, what I really would like is, if user selects a record in which the Inspection control (TxtInspection) value is "Stickers", then the button in the header should be hidden or deactivated in order to prevent said user to issue a useless report (because there can't be any inspection report when you just put a sticker on the Equipment). And I know for a fact that there are going to be mistakes made in that field, believe me...
I'm stuck here... Thank you in advance for your help!