Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Access
3rdpartyusrgrp
access
activexcontrol
adp.sqlserver
commandbarsui
conversion
dataaccess.pages
developers.toolkitode
devtoolkits
externaldata
forms
formscoding
gettingstarted
internet
interopoledde
macros
modulescoding
modulesdaovba
modulesdaovba.ado
multiuser
odbcclientsvr
queries
replication
reports
security
setupconfig
tablesdbdesign
  
 
date: Tue, 14 Oct 2008 09:48:15 -0700,    group: microsoft.public.access.forms        back       


Make fields visible and invisible on check box   
When I open my form there are two fields and a calendar button that I want to 
be hidden. When check box is clicked I want these fields and the button to 
become visible. I already tried a few things, on click, on open
If Field = "Yes" Then
Field.Visible = True 
Else
Field.Visible = False
End If
The fields I specify disappear but don't reappear when I check the box.
date: Tue, 14 Oct 2008 09:48:15 -0700   author:   mel

RE: Make fields visible and invisible on check box   
In a check box, -1 is a yes and 0 is a no. Try IF field = -1 then

"mel" wrote:

> When I open my form there are two fields and a calendar button that I want to 
> be hidden. When check box is clicked I want these fields and the button to 
> become visible. I already tried a few things, on click, on open
> If Field = "Yes" Then
> Field.Visible = True 
> Else
> Field.Visible = False
> End If
> The fields I specify disappear but don't reappear when I check the box.
>
date: Tue, 14 Oct 2008 10:24:00 -0700   author:   Golfinray

RE: Make fields visible and invisible on check box   
This might be simpler:

chkBox_Click() 'click event of a check box
  txt1.Visible = chkBox 'a text box on the form
  cbo1.Visible = chkBox 'a combo box on the form
  btn1.Visible = chkBox 'a button on the form
End Sub

When checking the box, you are setting its value to True, when unchecking 
it, you set it to False, so each of these applies to the .Visible property of 
the other controls.

"mel" wrote:

> When I open my form there are two fields and a calendar button that I want to 
> be hidden. When check box is clicked I want these fields and the button to 
> become visible. I already tried a few things, on click, on open
> If Field = "Yes" Then
> Field.Visible = True 
> Else
> Field.Visible = False
> End If
> The fields I specify disappear but don't reappear when I check the box.
>
date: Tue, 14 Oct 2008 10:26:02 -0700   author:   Brian

RE: Make fields visible and invisible on check box   
Hi Brian,
That works great!...except how do I make the boxes be hidden when I open a 
new record. When I open a new record the fields are there and I have to check 
and then un-check the box to make them disappear.

"Brian" wrote:

> This might be simpler:
> 
> chkBox_Click() 'click event of a check box
>   txt1.Visible = chkBox 'a text box on the form
>   cbo1.Visible = chkBox 'a combo box on the form
>   btn1.Visible = chkBox 'a button on the form
> End Sub
> 
> When checking the box, you are setting its value to True, when unchecking 
> it, you set it to False, so each of these applies to the .Visible property of 
> the other controls.
> 
> "mel" wrote:
> 
> > When I open my form there are two fields and a calendar button that I want to 
> > be hidden. When check box is clicked I want these fields and the button to 
> > become visible. I already tried a few things, on click, on open
> > If Field = "Yes" Then
> > Field.Visible = True 
> > Else
> > Field.Visible = False
> > End If
> > The fields I specify disappear but don't reappear when I check the box.
> >
date: Tue, 14 Oct 2008 12:23:00 -0700   author:   mel

RE: Make fields visible and invisible on check box   
Something like this. It makes them invisible on new records but visible on 
exisitng records. 

Private Sub Form_Current()
  If Form.NewRecord Then
    chkBox = False 'unchecks the box
Else
    chkBox = True 'checks the box
  End If
    chBox_Click 'runs the code from that event, which sets the Visible 
properties
End Sub

"mel" wrote:

> Hi Brian,
> That works great!...except how do I make the boxes be hidden when I open a 
> new record. When I open a new record the fields are there and I have to check 
> and then un-check the box to make them disappear.
> 
> "Brian" wrote:
> 
> > This might be simpler:
> > 
> > chkBox_Click() 'click event of a check box
> >   txt1.Visible = chkBox 'a text box on the form
> >   cbo1.Visible = chkBox 'a combo box on the form
> >   btn1.Visible = chkBox 'a button on the form
> > End Sub
> > 
> > When checking the box, you are setting its value to True, when unchecking 
> > it, you set it to False, so each of these applies to the .Visible property of 
> > the other controls.
> > 
> > "mel" wrote:
> > 
> > > When I open my form there are two fields and a calendar button that I want to 
> > > be hidden. When check box is clicked I want these fields and the button to 
> > > become visible. I already tried a few things, on click, on open
> > > If Field = "Yes" Then
> > > Field.Visible = True 
> > > Else
> > > Field.Visible = False
> > > End If
> > > The fields I specify disappear but don't reappear when I check the box.
> > >
date: Tue, 14 Oct 2008 12:34:01 -0700   author:   Brian

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us