Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2006, 01:56 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default Make visible/invisible

Hi all,

Does anyone know the best way to make a control or label visible or invisible given a certain circumstance?

-If a user input from one form matches a number in the library I want a button and a label to be invisible on the next form that comes up. Otherwise, I want the button and label to be invisible.

Thanks for any input,

Dave

 
Old May 30th, 2006, 02:05 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure what the sequence of events are.

Basically set the label and button to Visible = No as the default, and then use events (including the forms on current event) to check the value and set the property based on the value.

Where will the value be stored and how referenced?

mmcdonal
 
Old May 30th, 2006, 02:18 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The user inputs a design number in a textbox
The number is stored in variable mycnt
A query counts how many #'s match the one that was input

If the query counts one or more then a form opens with the matching records displayed on the screen.
If the query doesn't find a match then the form opens with a label saying no match and a button that can add the new #.

DoCmd.Requery
Dim mycnt, mycnt_new As Integer
mycnt = DCount("*", "Q_check_exist")
If mycnt >= 1 Then

David


 
Old May 30th, 2006, 02:20 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you saying set the button and label to Visible = No in properties or in the code?


dave

 
Old May 31st, 2006, 01:42 AM
Registered User
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

labelnomatch.visible = cbool(mycnt=0)
button.visible = cbool(mycnt=0)

 
Old May 31st, 2006, 09:20 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If mycnt >= 1 Then
    'Open form displaying designs
Else
    'Open different form stating no such record found, with button to add new record
End If

I don't believe you need to manipulate visibility to solve that problem.

 
Old May 31st, 2006, 10:59 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the feed back guys!

I tried the CBOOL code, but couldn't quite get it to work for me.
I think I may just go for the multiple form approach.

Thanks again,

-Dave






Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide and make visible scandalous ASP.NET 2.0 Basics 0 May 24th, 2007 08:51 AM
how to make the print button invisible dipti.agrawal ASP.NET 2.0 Basics 0 March 11th, 2007 01:20 PM
to make checkboxes visible in datagrid C# windows bhavna General .NET 1 March 5th, 2007 10:41 AM
visible/invisible stealthdevil Access VBA 4 December 1st, 2006 05:40 PM
How do you make a label visible in a form Brian263 Access 2 March 19th, 2004 03:32 PM





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