Results 1 to 5 of 5
  1. #1
    togo is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    83

    Requery not working (again)

    So I have one combo box at top of form that controls job number



    for each job there may be multiple reports, a combo box below that is used to select report, then a button is pushed to open that report for editing.

    I have other databases where this works fine. The report combo box contains the following SQL in the row source:

    SELECT DISTINCT EXAMINATIONREPORT.ReportNo FROM EXAMINATIONREPORT WHERE examinationreport.jobnumber = jobnumber;

    In the first combo box there is the following code:

    Code:
    DBEngine.Idle dbRefreshCache
    Form_MPI!ReportController.Requery
    Me.ReportController.RowSource = Me.ReportController.RowSource
    Me.ReportController.Requery
    Me.Requery
    Me!ReportController.Requery
    Set MPIreports = Forms!MPI!ReportController
    MPIreports.Requery
    Me.Refresh
    Me.Repaint
    So as you can see, up against the wall on this one. It just WILL NOT requery itself, since each job number has different numbers of reports or no reports at all, this combo box will change each time the job changes. The form is called MPI, but in its history it may have been renamed at one point, don't remember. I don't get why this method of selecting reports works on other forms but not this one. Thanks for any help.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    That's a whole lot of refreshing. Is your combo box pulling information that changes over time and you're trying to get the most recent information, or is it based on a fairly static list of items?

    If you're trying to retrieve a most recent list of items you'd likey need to do a

    me.refresh

    BEFORE you requeried the combo box

    Is that the code that existed before you attempted anything because you shouldn't need all that. ANd where does that code run, is it in the AFTER UPDATE or ON EXIT event of another field and you're asking it to update the secondary combo box (reportcontroller)?

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    This SQL:

    SELECT DISTINCT EXAMINATIONREPORT.ReportNo FROM EXAMINATIONREPORT WHERE examinationreport.jobnumber = jobnumber;

    is basically referring to itself, so I suspect you're getting all the records? To use Requery, you'd need to refer to a form or someplace for the value to filter to, like:

    SELECT DISTINCT EXAMINATIONREPORT.ReportNo FROM EXAMINATIONREPORT WHERE examinationreport.jobnumber = Forms!FormName.jobnumber;
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    istari88 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Kentucky, USA
    Posts
    13
    I think this is good
    DBEngine.Idle dbRefreshCache 'event
    Form_MPI!ReportController.Requery 'requery 1st commbobox


    Not Needed...
    Me.ReportController.RowSource = Me.ReportController.RowSource
    Me.ReportController.Requery
    Me.Requery
    Me!ReportController.Requery
    Set MPIreports = Forms!MPI!ReportController
    MPIreports.Requery
    Me.Refresh
    Me.Repaint

    Then Reference the 1st comboBox name in the record source of the 2nd.
    SELECT DISTINCT EXAMINATIONREPORT.ReportNo FROM EXAMINATIONREPORT WHERE examinationreport.jobnumber = Forms!MPI.1stComboBoxName;

    good luck
    Phil

  5. #5
    togo is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    83
    Hi been very busy with related projects sorry for late response. It looks like someone deleted the source table that the combo box referred to. This might explain why every other combo box update situation works but this one didn't. If the problem occurs again I'll resurrect the thread.

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

Similar Threads

  1. cascading combo boxes, .requery not working
    By jsmath22 in forum Forms
    Replies: 8
    Last Post: 10-12-2012, 12:28 PM
  2. Requery Report with VBA
    By tylerg11 in forum Reports
    Replies: 3
    Last Post: 07-30-2012, 10:41 AM
  3. Requery
    By Grizz2 in forum Queries
    Replies: 2
    Last Post: 05-31-2011, 10:23 AM
  4. Replies: 5
    Last Post: 03-17-2011, 06:21 AM
  5. Requery?
    By CO711 in forum Forms
    Replies: 0
    Last Post: 08-06-2008, 08:03 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