Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2009
    Posts
    4

    Cool Opening a form within a form

    Hi,

    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?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Use the acDialog parameter.

  3. #3
    Join Date
    Feb 2009
    Posts
    4
    Hi,

    I'm not very good with Access. Could you spell out what I need to do?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Post the code you have to open the other form.

  5. #5
    Join Date
    Feb 2009
    Posts
    4

    Code for the command button

    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

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    This should do it:
    Code:
    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, , acDialog
    Exit_CustForm_Click:
       Exit Sub
    Err_CustForm_Click:
       MsgBox Err.Description
       Resume Exit_CustForm_Click
    End Sub

  7. #7
    Join Date
    Feb 2009
    Posts
    4

    Thanks!

    Thank you! Not sure I would have ever figured that out, but knew it had to be something simple. Thanks again!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You're very welcome. If you highlight OpenForm and hit F1, the VBA help will show you all of the options.

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

Similar Threads

  1. Replies: 0
    Last Post: 11-10-2008, 12:32 PM
  2. Updating SQL server form Access form?
    By slash75 in forum Forms
    Replies: 1
    Last Post: 09-06-2008, 02:39 PM
  3. Replies: 2
    Last Post: 12-01-2006, 07:23 AM
  4. Replies: 0
    Last Post: 11-17-2006, 09:38 AM
  5. Automatic Filtering when Opening form
    By Karyn-2000 in forum Forms
    Replies: 1
    Last Post: 12-03-2005, 09:29 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