Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Posts
    173

    Unanswered: save command on another form

    I have a main form and another form that pops open when a combo box is double clicked to add/delete records from that combo. This same pop up form is accessed from another place in the database as well. I'd like to have a command sent from the pop up form that will send a save command to the main form only if the main form is open. Is this possible?

  2. #2
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150

    Arrow

    It is possible

    First of all you need to create a public Sub or function in the Main Form(Form1 in this scenario)

    Code:
    Public Sub Test()
        MsgBox "Hello world!"
        
    End Sub
    Then you will be able to call the function or sub from anywhere in your project as long as the form is open. Not that you will have to reference the form and then th efunction eg. Forms("FORMNAME").FUNCTION

    You will put this code in your pop-up. Comments are in the code

    Code:
        Dim x As Integer
        
        'Check if any Forms are open
        If Forms.Count > 0 Then
            
            'Loop through all the forms and check if the form is open
            For x = 0 To Forms.Count - 1
                'If it is open run the function
                If Forms(x).Name = "Form1" Then
                    Forms("Form1").Test
                End If
            Next
        
        End If
    Machado


Posting Permissions

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