Results 1 to 10 of 10
  1. #1
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100

    Return to form and make a control visible


    I have 2 forms frm1 and frm2. On ffrm1 I have a list box that is not visible. I click a button to go to frm2, which is not open until I click the button on frm1. Clicking the button on frm1 makes frm1 not visible and opens frm2. When I click a certain button on frm2 it makes frm2 invisible and re-opens frm1. My question is when frm1 re-opens I want the invisible list box to be visible and containing the data that frm2 has. How can I make this happen? Thanks, in advance, for all of your responses.

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    A lot we don't know here, like whether frm1 and frm2 are bound. In any case, it would be better if frm1 closed itself instead of not visible. Then the button on frm2 could open frm1 with openargs (telling frm1 to make the listbox visible).
    If openargs is null, then open frm1 with listbox invisible, as when first opened. If data is not appearing in listbox, then let us know and we can address that.
    Last edited by davegri; 11-09-2018 at 10:18 AM. Reason: sp

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you can do anything using the full path of the object,

    Code:
    btnGotoF1_click()
    docmd.openform "Frm1"
    forms!Frm1!lstBox.visible = true
    
    end sub
    (and you dont need to make Frm2 (or 1) invisible. Opening another form will send the current form to the back. A kindof invisible)

  4. #4
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    Quote Originally Posted by davegri View Post
    A lot we don't know here, like whether frm1 and frm2 are bound. In any case, it would be better if frm1 closed itself instead of not visible. Then the button on frm2 could open frm1 with openargs (telling frm1 to make the listbox visible).
    If openargs is null, then open frm1 with listbox invisible, as when first opened. If data is not appearing in listbox, then let us know and we can address that.

    I gues I wasn't really clear. Neither form is bound. I need frm1 to retain the information it has and add the information from frm2 so that i can save the complete data on frm1 to a table. I do use openargs when opening frm2. How do I use openargs to pass frm2 data back to the listbox?

  5. #5
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    Quote Originally Posted by ranman256 View Post
    you can do anything using the full path of the object,

    Code:
    btnGotoF1_click()
    docmd.openform "Frm1"
    forms!Frm1!lstBox.visible = true
    
    end sub
    (and you dont need to make Frm2 (or 1) invisible. Opening another form will send the current form to the back. A kindof invisible)

    I like to make the form invisible as a matter of personal taste. I think it just make things cleaner and less confusing for users. Pleas see my reply to davegri for further information. Thanks.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    How do I use openargs to pass frm2 data back to the listbox?
    What's the rowsource for the listbox? Is the listbox empty or is frm2 adding data to existing rows?



  7. #7
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    listboxes are bound to a query.

  8. #8
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    davegri:

    The rowsource for the list box in frm2 is assigned in VBA code and depends on the server name passed in from frm1. The rowsource is then based on a query.

    In frm1 I want the rowsource to be the same except that it will depend on the server name from frm1 and the service(s) passed back from frm2.

    List box in frm1 rowsource would be something like this:

    SELECT qryServerToService.Description FROM qryServerToService WHERE qryServerToService.Name=frm1cboServerNm and qryServertoService.Description=frm2lstbox.service ORDER BY Description;

    "Description" is a service. I think the rowsource would probably be assigned in VBA code when frm1 gets the focus after I return from frm2? How do I determine when frm1 regains the focus?

  9. #9
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    That seems very convoluted. Would it be possible to put both listboxes on the same form?

  10. #10
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    Quote Originally Posted by davegri View Post
    That seems very convoluted. Would it be possible to put both listboxes on the same form?
    I've tried that, but as you probably know there may be many services on any one server. When we record downtime, we need to record the server name and ONLY the service or services that will be unavailable while they are being updated or worked on even if the server is NOT being rebooted. Of course, if the server is Rebooted then ALL the services are considered as downtime. We consider unavailable services as downtime. I need the second form in order to choose which services are to be entered as downtime.

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

Similar Threads

  1. Replies: 6
    Last Post: 06-04-2018, 06:46 AM
  2. Replies: 17
    Last Post: 08-03-2017, 06:08 PM
  3. Replies: 16
    Last Post: 03-26-2015, 08:35 PM
  4. Replies: 1
    Last Post: 02-27-2015, 10:01 AM
  5. Replies: 3
    Last Post: 03-29-2012, 12:40 PM

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