469,342 Members | 6,455 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,342 developers. It's quick & easy.

HIDE / SHOW OF FORMS in MS Access

HI!!

If I have 2 forms ie form 1 , form 2

In Form 1 I have a command button to open form 2.

how will i hide form 1 and show form 2, until i click on close button it open form 1 and form 2 should hide. in ms access

how do i work on it on ms access?

Thanks & bye

Kartik
Apr 14 '07 #1
3 107585
Quick and cheap - Id use a simple macroso that the form 1 buttom runs the marco name (for instance) open_form2 where macro uses OpenForm (form2) -Close (object form1),


Then reverse the process in form 2


Gareth
Apr 14 '07 #2
ADezii
8,800 Expert 8TB
HI!!

If I have 2 forms ie form 1 , form 2

In Form 1 I have a command button to open form 2.

how will i hide form 1 and show form 2, until i click on close button it open form 1 and form 2 should hide. in ms access

how do i work on it on ms access?

Thanks & bye

Kartik
'To Open Form2 and Hide Form1
Expand|Select|Wrap|Line Numbers
  1. Me.Visible = False
  2. DoCmd.OpenForm "Form2", acNormal, , , acFormEdit, acWindowNormal
'To make Form1 visible again after Form2 is closed
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2.   Forms![frmTest].Visible = True
  3. End Sub
Apr 14 '07 #3
NeoPa
32,182 Expert Mod 16PB
Essentially, if switching between forms as in the original request, the original code would open both forms and could also have a procedure which could be called from anywhere which switched between one being visible and the other.

How this is triggered isn't specified so can be as flexible as you like but the code would be something like :
Expand|Select|Wrap|Line Numbers
  1. Public Sub SwitchForms()
  2.     With Forms("Form 1")
  3.         .Visible = Not .Visible
  4.     End With
  5.     With Forms("Form 2")
  6.         .Visible = Not .Visible
  7.     End With
  8. End Sub
2 Days Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by jerryyang_la1 | last post: by
1 post views Thread by Norman | last post: by
2 posts views Thread by Greg | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.