Solved Hiding buttons when the update query runs (1 Viewer)

Cheez

New member
Local time
Today, 04:10
Joined
Mar 6, 2022
Messages
17
Thank you all for you input on this. I'm was able to get it work.


Code:
Private Sub cmdSQL_Click()

RunUpdate Me.CustomerID
Buttons Me, "a1", False
Forms!CustomerF.Refresh

End Sub

Private Sub cmdSQL_Click()

RunUpdate Me.CustomerID
Buttons Me, "a1", False
Forms!CustomerT.Refresh

End Sub


 Option Compare Database
 
Public Sub RunUpdate(ByVal Cid)

    Dim A As String
    
DoCmd.SetWarnings False

A = "UPDATE CustomerT Set CustomerT.IsActive = true " _
    & "WHERE CustomerT.CustomerID=" & Cid & ""
    
DoCmd.RunSQL A
DoCmd.SetWarnings True

End Sub

Public Sub Buttons(ByRef frm As Access.Form, strCtlName As String, ynStatus As Boolean)

frm.Controls(strCtlName).Transparent = Not ynStatus
frm.Controls(strCtlName).Enabled = ynStatus

End Sub


Now if there's more than one button to be hidden, would I do this or is there another way?

Buttons Me, "a1", False
Buttons Me, "a2", False
Buttons Me, "a3", False
 

moke123

AWF VIP
Local time
Today, 05:10
Joined
Jan 11, 2013
Messages
3,852
Now if there's more than one button to be hidden, would I do this or is there another way?
There's always another way.

That is simple and will work just fine.
 

Users who are viewing this thread

Top Bottom