|
Subject:
|
visible/invisible
|
|
Posted By:
|
stealthdevil
|
Post Date:
|
12/1/2006 10:44:42 AM
|
hi again, one more thing I'm getting stuck on. I want to hide a button when it is clicked. But, the Visible property will not work for me b/c the button that has focus cannot be hidden. Is there another command for this?
Private Sub btnLock_Click() Dim Answer As VbMsgBoxResult Answer = MsgBox("Are you sure you want to lock line setup?", vbYesNo, "Lock Options") If Answer = 6 Then btnParameters.Visible = False btnFill.Visible = False Command1.Visible = False Label3.Visible = False Label25.Visible = False Label12.Visible = False btnUnlock.Visible = True btnLock.Visible = False (this is where problem is) End If End Sub
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
12/1/2006 2:51:54 PM
|
Create a public variable in a module to hold a boolean. The default value for a boolean variable is False.
Reset the focus at the end of the If Then statement to another likely control and set the boolean to True.
Then set the form's On Current property to check the public variable. If it = true, which it only will after this routine, then make the button invisible.
Did that work?
mmcdonal
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
12/1/2006 2:54:09 PM
|
Alternatively, if this is a bound form, create an additional column in the table, and make it Yes/No. Then at the end of your routine, set this column to Yes (No is the default) and check it On Current. This will allow you to keep the same formatting as you move from one record to the next.
You will still need to set a public variable to make this happen right away, probably.
mmcdonal
|
|
Reply By:
|
stealthdevil
|
Reply Date:
|
12/1/2006 4:17:03 PM
|
Thanks for the response!
I'll give this a try.
|
|
Reply By:
|
stealthdevil
|
Reply Date:
|
12/1/2006 4:40:26 PM
|
Well I didn't get the boolean variable to work for me. But you did point me in the right direction. I had to change the focus, so I added this If statement directly after the other one:
If Answer = 6 Then
Forms!Main!btnUnlock.SetFocus
btnLock.Visible = False
End If
I didn't really think this would work since its still in the same click event, but it did so I'm going with it!
Thanks one again mmcdonal,
Dave
|