Results 1 to 7 of 7
  1. #1
    BCJourney is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Location
    Cincinnati, OH
    Posts
    46

    make form invisible, then visible when query closes


    On "form1" i click a button and it opens a different form (form2) based on a query. Since "form2" opens behind "form1", I've set "form1" to be invisible when "form2" opens.
    I want "form1" to be visible after i close "form2". I am stuck at the visible again part. the code I have in the close event of "Form2" is:
    Code:
    DoCmd.SetProperty [Forms]![form1], acPropertyVisible, True
    This won't work. I get the "An expression you entered is the wrong data type for one of the arguments" error message. Any suggestions?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you open Form2 with the acDialog argument then the code in Form1 waits there for Form2 to close or go invisible.

  3. #3
    BCJourney is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Location
    Cincinnati, OH
    Posts
    46
    This is what I put in form1:
    Code:
    Private Sub CmdNewServ_Click()
    
        Me.Visible = False
        DoCmd.OpenForm server_new_30, acNormal, , , acDialog
    End Sub
    I get an error

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is "server_new_30" the name of your Form2? It should be a string value. acNormal is the default so it need not be specified. acDialog is the 6th argument and not the 5th.
    Code:
    Me.Visible = False
    DoCmd.OpenForm "server_new_30", , , , , acDialog
    Me.Visible = True

  5. #5
    BCJourney is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Location
    Cincinnati, OH
    Posts
    46
    i apologize, "server_new_30" is form2. i put your code in the onclick event of the button on form1 that opens form2. form2 went invisible and form2 opened. when i closed form2 i got an error. I don't know what code should be in the unload event of form2. thanks so much.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by BCJourney View Post
    I don't know what code should be in the unload event of form2. thanks so much.
    Nothing! It is taken care of in Form1 if you used all of my code.

  7. #7
    BCJourney is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Location
    Cincinnati, OH
    Posts
    46
    I got it now. You are correct! Thank you so much.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to make a field invisible in form view?
    By snowboarder234 in forum Forms
    Replies: 3
    Last Post: 10-25-2012, 12:43 PM
  2. Make result invisible in Form?
    By RachelBedi in forum Forms
    Replies: 1
    Last Post: 10-23-2012, 09:12 AM
  3. Invisible/visible box
    By teirrah1995 in forum Forms
    Replies: 4
    Last Post: 10-03-2010, 02:45 AM
  4. Setting fields visible/invisible
    By col5473 in forum Forms
    Replies: 1
    Last Post: 09-17-2010, 09:14 AM
  5. Combo Boxes Visible/Invisible
    By Rick West in forum Forms
    Replies: 2
    Last Post: 07-06-2010, 09:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums