Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 1st, 2006, 11:44 AM
Friend of Wrox
 
Join Date: May 2006
Location: Jonesboro, AR, USA.
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default visible/invisible

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 With Quote
  #2 (permalink)  
Old December 1st, 2006, 03:51 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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 With Quote
  #3 (permalink)  
Old December 1st, 2006, 03:54 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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 With Quote
  #4 (permalink)  
Old December 1st, 2006, 05:17 PM
Friend of Wrox
 
Join Date: May 2006
Location: Jonesboro, AR, USA.
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the response!

I'll give this a try.

Reply With Quote
  #5 (permalink)  
Old December 1st, 2006, 05:40 PM
Friend of Wrox
 
Join Date: May 2006
Location: Jonesboro, AR, USA.
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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:

Code:
    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



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make visible/invisible stealthdevil Access VBA 6 May 31st, 2006 10:59 AM
visible vs. not visible on form akibaMaila VB.NET 2002/2003 Basics 2 August 15th, 2005 02:40 PM
invisible console app asmotritsky Visual C++ 1 November 25th, 2004 03:27 PM
Underscore to be invisible jmaronilla Beginning PHP 2 September 15th, 2004 09:37 AM
Invisible HyperLink acko ASP.NET 1.x and 2.0 Application Design 2 January 19th, 2004 01:00 PM



All times are GMT -4. The time now is 07:41 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.