+ Reply to Thread
Results 1 to 2 of 2

Opening a form within a form

  1. #1
    Webtekr
    Guest

    Opening a form within a form

    Hi Friends,

    I m new to Access. can anyone solve my problem please??

    I have placed a command button in one form that when pushed, brings up a different relevant form. The new form pops up behind the current form, but I would like for it to show up in front of the current form instead. How do I do that?

    Code i use in my form

    Private Sub CustForm_Click()
    On Error GoTo Err_CustForm_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Customers"

    stLinkCriteria = "[Customer]=" & "'" & Me![Customer] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_CustForm_Click:
    Exit Sub
    Err_CustForm_Click:
    MsgBox Err.Description
    Resume Exit_CustForm_Click

    End Sub

  2. #2
    Registered User
    Join Date
    03-20-2008
    Location
    Buffalo, NY USA
    Posts
    43

    Re: Opening a form within a form

    You can change the popup form's properties to Popup or Modal. Popup set to yes will not allow the focus to move anywhere else in the db but that form until that form is closed. Modal will keep the form on top of other forms, but allow the focus to change to another form. Popup forms by nature are modal (in the sense that they are always on top) but Modal forms are not Popups, as the focus can change to other objects. This is all set in the forms properties on the Other tab. You can experiment with both properties and see which behavior you prefer.


    Another method you can use is to call up the form as dialog on the fly by changing:

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Dialog mode will act in the same manner as a Popup form (keeping the focus), but it will also halt the code until the form is closed. This means that if you had subsequent code under your Docmd.OpenForm call, it wouldn't execute using this method (until the form closes), but could happen using the first method I mentioned. In your case, there is no following code, so this would be a viable method. Sorry if this is all a bit overkill...The coffee is finally kicking in.

    Brent

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1