Hi All!
I have a subForm that lists .pdf files that are attached to the parent record in the main form. Next to each .pdf record in the subForm, there is a CommandButton that is either used to attach a new .pdf (new record) or remove an existing .pdf. What I would like to do is have the subForm loop through all the records and change the Caption for the CommandButton to "Remove" if it is associated with an existing record or "Attach" if it is associated with a new record. The way I am trying to do it now is with the following:
Private Sub Form_Current()
If Not IsNull(Me.file_path) Then
Me.cmdLinkFile.Caption = "Remove"
Me.cmdLinkFile.ForeColor = 255
Me.cmdLinkFile.ControlTipText = "Remove file from this record."
Else:
Me.cmdLinkFile.Caption = "Attach"
Me.cmdLinkFile.ForeColor = 0
Me.cmdLinkFile.ControlTipText = "Link file to this contract."
End If
End Sub
The problem I'm having with this is that if the record has at least 1 .pdf associated with it, it changes the caption on all of the CommandButtons (including the new record) to "Remove" and changes the caption on the new record CommandButton to "Attach" only if there are no .pdf files associated with the master record.
Has anybody done anything like this before? And, if so, could you share your thoughts with me.
Thanks in advance!
Nathan C. Hoialmen
President
Encephalon Business Solutions, LLC
I have a subForm that lists .pdf files that are attached to the parent record in the main form. Next to each .pdf record in the subForm, there is a CommandButton that is either used to attach a new .pdf (new record) or remove an existing .pdf. What I would like to do is have the subForm loop through all the records and change the Caption for the CommandButton to "Remove" if it is associated with an existing record or "Attach" if it is associated with a new record. The way I am trying to do it now is with the following:
Private Sub Form_Current()
If Not IsNull(Me.file_path) Then
Me.cmdLinkFile.Caption = "Remove"
Me.cmdLinkFile.ForeColor = 255
Me.cmdLinkFile.ControlTipText = "Remove file from this record."
Else:
Me.cmdLinkFile.Caption = "Attach"
Me.cmdLinkFile.ForeColor = 0
Me.cmdLinkFile.ControlTipText = "Link file to this contract."
End If
End Sub
The problem I'm having with this is that if the record has at least 1 .pdf associated with it, it changes the caption on all of the CommandButtons (including the new record) to "Remove" and changes the caption on the new record CommandButton to "Attach" only if there are no .pdf files associated with the master record.
Has anybody done anything like this before? And, if so, could you share your thoughts with me.
Thanks in advance!
Nathan C. Hoialmen
President
Encephalon Business Solutions, LLC