Results 1 to 7 of 7
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    pop up form

    All; using Access 2016. I have a subform that when open on main form; may have multiple records. I want to have a pop up form to display the records in datasheet view of that particular customer. I can start with creating the form for customer but how would I link the customer records to the customer open on the form?

  2. #2
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    you simply reference the CustomerID from your main form in the recordsource of the pop-up form (Forms!frmYourMainFormWithSubform!CustomerID) then in the OnCurrent event of the main form you check to see if the pop-up form is open (using the public function below) and if it is you simply requery it.
    Code:
    Public Function IsOpen(ByVal strFormName As String) As Boolean
    
        IsOpen = False
        ' is form open?
        If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
            ' if so make sure its not in design view
            If Forms(strFormName).CurrentView <> 0 Then
                IsOpen = True
            End If
        End If
    
        Exit Function
    
    End Function
    Cheers,
    Vlad

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Quote Originally Posted by pbaldy View Post
    So; this code behind a cmd button?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Wherever you want it. A button, the double click event of a textbox, etc.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Worked like a charm...will remember this code...thanks all

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

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