Results 1 to 8 of 8
  1. #1
    texas1014 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    13

    requery

    I am working on a form that has a subform. I added a button to update the table that the subform is reading from, but the subform does not refresh. I have the subformName.requery in the coding and still nothing. Everytime I exit out of the form and go back in, the form is refreshed, though.



    Any advice?

  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,922
    Try: subformName.FORM.requery

  3. #3
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Code:
    Me.FormName.Requery

  4. #4
    texas1014 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    13
    Thanks. it worked. But I used the me.requery instead of writing the form name and it still worked. Now I am coming to an issue where it updates the table twice? I only need it entered once and I only have coding to insert the data once.

  5. #5
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Do you have a similar requery statement somewhere else? perhaps in a "form load" event..?

    Posting your code would be extremely helpful as well.

  6. #6
    texas1014 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    13
    I don't have the code anywhere else, at least not that I am aware of. Is there a way to check for that?

    My coding is below. I changed the actual names bc this is work sensitive material.


    Private Sub btnAddInfo_Click()
    CurrentDb.Execute "INSERT INTO tblMaster_File(S_ID, S_Description, F_ID, F_Description, Cl_ID, Cl_Description, Com_ID, Comy_Description) " & _
    " VALUES (" & Me.S_ID & ",'" & Me.S_Description & "','" & Me.F_ID & "','" & Me.F_Description & "','" & _
    Me.Cl_ID & "','" & Me.Cl_Description & "','" & Me.Com_ID & "','" & Me.Com_Description & "')"

    Me.Requery

    End Sub

  7. #7
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Huh, I am not sure. Perhaps having Me.Requery instead of Me."FormName".Requery is causing the problem, idk.
    There is a way to check that, but for what is happening to you I do not think it will be much help. But if you are curious and for future reference this is how:
    1. In Database Tools select Database Documenter.
    2. Click All Objects tab in the pop-up and select all the objects that are tied to your form.
    3. Click Ok. It takes you to a print preview page.
    4. On the right side in the Data section select either Word or Text File (i prefer text file).
    5. Check the box that says "open the destination file..." and click ok.
    You will basically be looking at a text file of your database. You can peruse it and search for where you may have an extra Requery statement.

  8. #8
    texas1014 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    13
    Nick, Thank you very much. I will be looking at this documentation feature more.

    I stepped through my code and somehow I had the table updated twice, once behind the scenes (best way I could describe it) and with the SQL syntax. Once I commented out the code, it only updated once.

    Thanks again for all of your help.

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

Similar Threads

  1. requery
    By raffi in forum Forms
    Replies: 2
    Last Post: 01-05-2015, 01:22 PM
  2. Requery Solved
    By sergran in forum Programming
    Replies: 12
    Last Post: 08-30-2013, 07:24 AM
  3. Combo Box Will Not Requery
    By clchapin in forum Programming
    Replies: 3
    Last Post: 08-01-2013, 08:51 AM
  4. Requery
    By Grizz2 in forum Queries
    Replies: 2
    Last Post: 05-31-2011, 10:23 AM
  5. Requery?
    By CO711 in forum Forms
    Replies: 0
    Last Post: 08-06-2008, 08:03 AM

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