Results 1 to 7 of 7
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Make form visible from VBA code

    I have an app whose startup module opens a form thus:



    DoCmd.OpenForm "frmLinkCntl", , , , , acHidden

    Form "frmLinkCntl" in turn opens another form "Addrlst-II". Form "Addrlst-II" has a command button whose click event attempts to make form "frmLinkCntl" visable before closing "Addrlst-II".

    The statement attempting to make "frmLinkCntl" visible fails. I assume because I've not code the "Forms" statement correctly?

    Forms("frmLinkCntl")!Form.Visible = True

    I get this error:Click image for larger version. 

Name:	Error2465.jpg 
Views:	11 
Size:	19.8 KB 
ID:	19050

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try:

    Forms("frmLinkCntl").Visible = True
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Forms("frmLinkCntl").Visible = True

    Gets me error:

    Click image for larger version. 

Name:	Error 2450.jpg 
Views:	11 
Size:	22.5 KB 
ID:	19051

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The code works for me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    June,
    I'll have access to a ACCESS 2010 system in the AM and will compile there to see if I can have the same success that you've had. ACCESS 2003 has a historical problematic issue with the use of acHIDDEN used with DoCmd.OpenForm so maybe I've bumped my head against that.
    Bill

  6. #6
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    From the error code I think the form you are trying to unhide is CLOSED.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    June, my app fails the same way with A2010 as it does in A2003. Rather than bother you with sending the app, I decided on a different approach.

    You'll recall, and perhaps other followers of this thread will as well, that this all started with my post regarding the problem with the query wherein I was attempting to JOIN fields from two tables where the tables WERE NOT stored in the SAME back-end mdb. (Query Forum Post: "Syntax error in From clause") Following the URL you posted there, wherein Albert and Dirk posted code to both check for and delete a linked table, I'll use that code to switch a table link from one back-end mdb to another.

    In my app, the form "Addrlst-II" has as its RecordSource a query based on the table "Addrlst". With that, one MUST CLOSE the form "Addrlst-II" if the table it's bound to is to be changed from one back-end to another. I have not yet employed Albert's and Dirk's code yet, but I've successfully implemented code to deal with the closing of "Addrlst-II" and opening of another form to interface with the user's choice of a different table source, followed by a re-opening of "Addrlst-II". That form's code module will attend to the re-linking of table "Addrlst".

    Thanks for your help and the time others spent on this thread,
    Bill

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

Similar Threads

  1. Replies: 6
    Last Post: 12-13-2014, 09:20 PM
  2. Make Report Label Visible (or not)
    By libraccess in forum Reports
    Replies: 5
    Last Post: 11-02-2013, 07:50 PM
  3. Replies: 6
    Last Post: 08-22-2013, 05:35 AM
  4. Replies: 8
    Last Post: 10-26-2012, 09:17 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