Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggle button to make a subform visible / unvisible 1

Status
Not open for further replies.

5tr0ud

Programmer
Aug 9, 2004
29
US
Does anyone know the coding to use behind a toggle button on a Main form, in which the user can toggle between making the subform visible and unvisible? Thanks.
 
Sure, there are a few ways to do it. Here's a simple way. Let's say you have two forms, frmMain and frmSub. On frmMain, you have a command button, cmdToggleSub. Here's the code that you put in cmdToggleSub's click event handler:

Sub cmdToggleSub_Click()
frmSub.Visible = Not frmSub.Visible
End Sub

HTH

Bob
 
Thanks. You refreshed my memory, and I did something similar to your code, but put it all on the subform. Thanks again.
 
You can also toggle the subform between "Form View" and "Datasheet View", using DoCmd.RunCommand (or DoDmd.DoMenuItem in previous versions of Access).
 
GPOTony, that looks like Access VBA not VB!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Johnwm - Doh! Yes, you're right.
Perhaps there is an equivalent in VB?
 
Not really - the term subform has a special meaning in Access

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top