Results 1 to 3 of 3
  1. #1
    vad77 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105

    Question Requery 1 of 3 forms that is open

    I have 3 forms that pull data table from the same table based on criteria in the query. FormA for System A, FormB for System B and FormA for System A. Only one of these forms are open at any given time.Each of these forms has an add record command button and I am using the same for form, AddRecord. There are 3 command buttons set to add a record record for each system.
    After the data entry is complete I need to requery the for is is open.
    Example: I have FormB open and add a record. When I hit the save I need it to requery FormB. Using If and Elseif can I determine which form is open?




    Private Sub cmdSave_Click()
    If Me.Dirty Then
    DoCmd.RunCommand acCmdRefresh


    Else


    End If

    If <FormA> is open Then


    MsgBox "The station has been added.", vbOKOnly, "Save Station"

    Forms!frm_FormA.Requery


    Elseif <FormB> is open Then


    MsgBox "The station has been added.", vbOKOnly, "Save Station"

    Forms!frm_FormB.Requery

    Elseif <FormC> is open Then

    MsgBox "The station has been added.", vbOKOnly, "Save Station"

    Forms!frm_FormC.Requery

    End IF

    End Sub


    I hope I am clear in what I am asking. Any assistance would be greatly appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    dim f as form

    for each f In forms
    f.requery
    next

  3. #3
    vad77 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105
    Thank you for the reply. It turns out I was looking at this as a complex task which it was not. I also explained it in a complicated way. Just wanted to requery the active form and I found out how. Never used this before since all the databases I created are for my own use.

    Screen.Activeform.requery

    This worked.

    Thanks

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

Similar Threads

  1. Requery command in Forms
    By deepakg27 in forum Forms
    Replies: 4
    Last Post: 01-14-2018, 02:24 AM
  2. Replies: 3
    Last Post: 10-15-2015, 08:48 PM
  3. Replies: 9
    Last Post: 06-03-2014, 09:33 AM
  4. Replies: 2
    Last Post: 08-07-2013, 07:44 AM
  5. Simple Requery Structure - Continous Forms
    By JeffG3209 in forum Programming
    Replies: 8
    Last Post: 06-10-2011, 07:18 PM

Tags for this Thread

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