Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    30

    Unanswered: saving field from one form onto another form

    I have a form that I want users to input new data on, and on this form I create a button that launches another form to help select input for the field on the first form. I can launch the second form, and get the data in one of the fields that I want, but then I want to make a button that will:

    1) Write the value that I wish to have saved on the pop up form into the field that I wish it to save to on the main form.

    2) Close the form.

    There is a form close function built into access already, but not knowing vb and being unable to find any resources to learn I am stuck! I learn as I go along, and all of you are the teachers. Please help, I am going crazy.

  2. #2
    Join Date
    Jul 2004
    Posts
    64
    How are you opening the pop up form?

  3. #3
    Join Date
    Jun 2004
    Posts
    30
    I am using a button on the main form to open the popup form

  4. #4
    Join Date
    Jul 2004
    Posts
    64
    No, I mean what are you using to open the form when you press the button?
    Macro?
    Code?
    This will help us in knowing how to help you..

  5. #5
    Join Date
    Jun 2004
    Posts
    30
    Its the generated code from the button wizard, as displayed below

    Code:
    Private Sub Command26_Click()
    On Error GoTo Err_Command26_Click
    
        Dim stDocName As String
        Dim stLinkCriteria As String
    
        stDocName = "neededpartspopup"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    Exit_Command26_Click:
        Exit Sub
    
    Err_Command26_Click:
        MsgBox Err.Description
        Resume Exit_Command26_Click
        
    End Sub
    Thank you

  6. #6
    Join Date
    Jul 2004
    Posts
    64
    Ok, so let me see if I got this right.

    You push a button that opens a pop up form. Then you want to take a field on the pop up form and have its value transferred back to the main form and then close the pop up?

  7. #7
    Join Date
    Jun 2004
    Posts
    30
    Yes...although I thought I could transfer the value upon pressing the close button on the pop up form.

  8. #8
    Join Date
    Jul 2004
    Posts
    64
    Do you have code for that close button? You should be able to.. Either that or you can use another event from the popup to send the value back to the main form.. Just depends really on how you want it to happen

  9. #9
    Join Date
    Jun 2004
    Posts
    30
    Here is the code for the close button.

    Code:
    Private Sub Command4_Click()
    On Error GoTo Err_Command4_Click
    
    
        DoCmd.Close
    
    Exit_Command4_Click:
        Exit Sub
    
    Err_Command4_Click:
        MsgBox Err.Description
        Resume Exit_Command4_Click
        
    End Sub

Posting Permissions

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