Roger said:
The problem is straight forward. You can't use code behind a control to
hide the control itself. You have to put the code somewhere else, but since
I don't know what the form is doing or why the button needs to be hidden, I
can't really advise.
The form is gathering user input which is used with info from several
tables to generate a machine setup sheet. the command button concerned
is used to tell the code that the user wants to use the calculated jo
block set instead of a master disc for a given size. When the button is
clicked I want it to pull the calculated values for the jo block stack
from several labels on the form and give them to the generator for the
machine setup sheet. Once the user clicks on the button I want the
button to be hidden. Below is the full code for the click event of this
button:
Private Sub cmdUseJoBlocks_Click()
Form_frmSizeSheet.lblMasterNo.Caption = "N/A"
Form_frmSizeSheet.lblJB1.Caption = lblJB1.Caption
Form_frmSizeSheet.lblJB2.Caption = lblJB2.Caption
Form_frmSizeSheet.lblJB3.Caption = lblJB3.Caption
Form_frmSizeSheet.lblJB4.Caption = lblJB4.Caption
Form_frmSizeSheet.lblJB5.Caption = ""
Form_frmSizeSheet.lblJB6.Caption = ""
Form_frmSizeSheet.lblMasterSize.Caption = lblJBTotal.Caption
Form_frmSizeSheet.lblGageSetting.Caption = Format(0, "0.0000")
Form_frmSizeSheet.lblMasterSection.BackColor = &HFFFFFF
Form_frmSizeSheet.lblJBSection.BackColor = RGB(167, 218, 78)
ggReadyToPrint
End Sub
Function ggReadyToPrint()
cmdUseJoBlocks.Visible = False <------- depending on which button
cmdUseMaster.Visible = False <------- is clicked one of these
lstMasters.Visible = False will error out.
lblJB1.Visible = False
lblJB2.Visible = False
lblJB3.Visible = False
lblJB4.Visible = False
lblJBTotal.Visible = False
txtShopOrder.Visible = True
cmdGenerateSheet.Visible = True
lblJoBlocks.Visible = False
lblPlus.Visible = False
lneSum.Visible = False
txtShopOrder.Visible = True
End Function