Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004

    Unanswered: How to link forms

    I have a form which shows order header information ie order number,customer, order date, etc. I also have a form that shows order detail information ie order number, qty,price etc. I do not want a master/detail form, what i want is a command button on the header form that when clicked opens up the details form to show details of the order.I have a command button on the header form that already opens up the details form but it does not show the details of the header form. How do i open up the details form to show the details based on the header forms data?????


  2. #2
    Join Date
    Nov 2004
    Provided Answers: 1
    I assume you have some sort of key that links the header to the details?

    If this is the case you can reference the header form from the detail form and load the records using this key.

    If you do not have any sort of link then no go, can't be done I don't think.

  3. #3
    Join Date
    Sep 2004
    Yes, the link is the Order Number. I want to know what code i would use in the command button to open the new form(detail) and reference the data relevant to Header form.

  4. #4
    Join Date
    May 2004
    Private Sub Button_Click()
    'link forms
    Public g_intOrderNum As Integer
    Dim intOrderNumber As Integer
    g_intOrderNum = _
    'on click, open form2
    End Sub
    Then from the 2nd Form, just set that global variable equal to where ever you're populating it. like txtPopulateOrderNum.Text = g_intOrderNum

    That's how I'd do it, assuming you're using simple text boxes to populate the data. Just create a global variable, set to to something, then call it from the second Form.

    Hope this helps ya

  5. #5
    Join Date
    May 2004
    Um, you don't even need to set such a broad scope on the variable. As long as Form1 is still open, on Form2 any form variable is still available using the proper syntax.

    For instance, if your order number is stored in a text box on form1, say txtOrder_num.text then on Form2 simply use Form1.txtOrder_num.text

    If form 1 is closed and you try this you will get a null value, I think.

    Does that answer your question? Did I understand it correctly?

Posting Permissions

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