Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239

    Update form after popup ?

    Hi,



    I have main form, on which I have subfom. Subform gives me a list of names that I want to enter in record. To enter a new name I have command button to open another POPUP FORM.

    I want that new saved name with all others from POPUP form, would appear in the Subfom, on the main form. And that would be without closing main form, only closing POPUP form.

    Tried "Refresh" macro on Close, Open, Current, Before/After Update... And this code, everything unsuccessful :

    Forms!YourFormNameHere.Requery

    Please help me !

    Regards, Luka

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Only a Requery will show new records. In your Command button, open the PopUp with the acDialog argument which will stop the code in the first form right there. Then do the Requeries you need after the OpenForm which will execute *after* the PopUp closes.

  3. #3
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    Ok, guess like it's possible. Could you give me more specific instructions, I'm not quite good at programming. This is my code for command button on Click (Open isn't there):

    Private Sub Ukaz81_Click()
    On Error GoTo Err_Ukaz81_Click


    Dim stDocName As String
    Dim stLinkCriteria As String


    stDocName = "NADZORNIK"
    DoCmd.OpenForm stDocName, , , stLinkCriteria


    Exit_Ukaz81_Click:
    Exit Sub


    Err_Ukaz81_Click:
    MsgBox Err.Description
    Resume Exit_Ukaz81_Click

    End Sub

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Something like this:
    Code:
    Private Sub Ukaz81_Click()
       On Error GoTo Err_Ukaz81_Click
       Dim stDocName As String
       stDocName = "NADZORNIK"
       DoCmd.OpenForm stDocName, , , , , acDialog
       Me.Requery
       Me.SubFormControl.Form.Requery
    Exit_Ukaz81_Click:
       Exit Sub
    Err_Ukaz81_Click:
       MsgBox Err.Description
       Resume Exit_Ukaz81_Click
    End Sub
    ...using your form names of course.

  5. #5
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    Sorry, still don't know how to do It, I'm not a programmer, I told you.

    Names of my Forms: - "VNOS_POGODBE" (main form)
    - "NADZORNIK" (popup form)
    - "VNOS_NADZORNIKA" (subform in the main form, where change must appear)


    Where must I use my names, and which ones ?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I'm going to guess that the SubFormControl is named the same as the SubForm it displays. Therefore, this should work:
    Code:
    Private Sub Ukaz81_Click()
       On Error GoTo Err_Ukaz81_Click
       Dim stDocName As String
       stDocName = "NADZORNIK"
       DoCmd.OpenForm stDocName, , , , , acDialog
       Me.Requery
       Me.VNOS_NADZORNIKA.Form.Requery
    Exit_Ukaz81_Click:
       Exit Sub
    Err_Ukaz81_Click:
       MsgBox Err.Description
       Resume Exit_Ukaz81_Click
    End Sub

  7. #7
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    I tried, but It didn't work. Names are matching, what else could go wrong ?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    No errors? Which form do you want to have updated?

  9. #9
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    No errors. I want to have updated Subform (VNOS_NADZORNIKA) on the main form (VNOS_POGODBE). If I close main form and open again, It updates, otherwise not.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Something else is going on because the code I gave you *will* work.

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    If it is the pop up form that is updating the recordset, perhaps you should run the requery from the pop up form.

    Forms!VNOS_POGODBE!VNOS_POGODBE.Form.Requery

    Is there any code in the pop up form? Maybe a command button to close the form?

  12. #12
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    Pop-up form is updating It's own table, but data of that table must be sent to Subform table in order to link wih main table. Yes I have command button to close the form, I will try what you said. So this code with repeated name of form is correct ?

  13. #13
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    Quote Originally Posted by ItsMe View Post
    If it is the pop up form that is updating the recordset, perhaps you should run the requery from the pop up form.

    Forms!VNOS_POGODBE!VNOS_POGODBE.Form.Requery

    Is there any code in the pop up form? Maybe a command button to close the form?
    I get runtime error "2450", but the name of main form (VNOS_POGODBE) is correct. Is pop-up form not linked with It or is the double name in code wrong ? Name of the pop-up form is INVESTITOR. Or must I add your code between all previous code of RuralGuy ?

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Quote Originally Posted by Lukael View Post
    Pop-up form is updating It's own table, but data of that table must be sent to Subform table in order to link wih main table. Yes I have command button to close the form, I will try what you said. So this code with repeated name of form is correct ?
    Where is the "data from that table sent to the Subform"?

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Sorry, I typed the subform name incorrectly.

    Forms!VNOS_POGODBE!VNOS_NADZORNIKA.Form.Requery

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. popup form
    By Cosmo Monkey in forum Forms
    Replies: 1
    Last Post: 03-25-2013, 03:06 PM
  2. Replies: 1
    Last Post: 02-21-2013, 12:27 PM
  3. Replies: 15
    Last Post: 02-17-2012, 09:20 AM
  4. form popup
    By fabiobarreto10 in forum Forms
    Replies: 30
    Last Post: 01-19-2012, 01:54 PM
  5. Popup Form
    By NISMOJim in forum Forms
    Replies: 1
    Last Post: 10-23-2010, 09:16 AM

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