Results 1 to 3 of 3
  1. #1
    EuniceH is offline Novice
    Windows Vista Access 2000
    Join Date
    Oct 2011
    Posts
    11

    after DAO update, listbox.requery not refreshing

    I must have made some global change, but don't remember what could have done this.
    Suddenly after I make any DAO update or insert, (and I can do this by doing DAO.Recordset .Update, or .AddNew or dbTable.execute with a sql string)... when I requery the listbox, it doesn't refresh, I have to hit my Refresh button which does the same thing, requeries the list box (me.listbox.Requery) and maybe wait 2 or 3 seconds, then hit it again, then it refreshes.
    What could cause this?

    I put in a timer and the refresh happened fine.

    None of this worked:
    DoEvents
    DBEngine.Idle dbRefreshCache
    DoEvents

    Me.Refresh
    Me.lstDocstoVerify.RowSource = "qselEuniceEditCustomersDocumentsList"
    If Me.Dirty Then
    RunCommand acCmdSaveRecord

    Finally this worked, changing the DAO.Recordset .Update to a sql query:
    'Update tblContractFOFs
    strSQL = "Update tblContractFOFs Set ReceivedDTS = Now(), ReceiverID = " & glngUserID & ", " & _
    "ReceiveNotes = '" & Me.txtDocumentNotes & "', ModDTS = Now() " & _
    "Where ContractFOFID = " & CLng(Nz(Me.lstDocstoVerify, 0))
    CurrentDb.Execute strSQL

    here's a sample code:
    Private Sub cmdDocumentsVerify_Click()

    Dim rst As DAO.Recordset
    Dim varResult As VbMsgBoxResult
    Dim varSCAPTransID As Variant
    Dim lngSCAPTransID As Long
    Dim fCOPrintOnly As Boolean

    On Error GoTo Error_Handler



    If glngUserID = 0 Then DoCmd.OpenForm FormName:="frmGetUser", WindowMode:=acDialog

    If IsNull(Me.lstDocstoVerify) Then
    MsgBox "Please select a Document to verify before continuing...", vbExclamation, "Attention!"
    Me.lstDocstoVerify.SetFocus
    Else
    If IsNull(Me.txtDocumentNotes) Then
    varResult = MsgBox("Would you like to enter a verification note before continuing?", vbQuestion + vbYesNoCancel + vbDefaultButton2, "Attention!")
    Select Case varResult
    Case vbYes
    Me.txtDocumentNotes.SetFocus
    Exit Sub
    Case vbCancel
    Exit Sub
    End Select
    End If

    fCOPrintOnly = CBool(Me.lstDocstoVerify.Column(8))

    'Update tblContractFOFs
    Set rst = gdbTables.OpenRecordset("tblContractFOFs")
    With rst
    .Index = "ContractFOFID"
    .Seek "=", CLng(Nz(Me.lstDocstoVerify, 0))
    If Not .NoMatch Then
    .Edit
    If fCOPrintOnly Then !LastPrintDTS = Now()
    !ReceivedDTS = Now()
    !ReceiverID = glngUserID
    !ReceiveNotes = Me.txtDocumentNotes
    !ModDTS = Now()
    .Update
    End If
    End With

    ...
    cmdDocumentsRefresh_Click

    End If

    Exit_Error_Handler:
    Exit Sub

    Error_Handler:
    Select Case Err.Number
    Case INITIALIZE_GLOBALS_ERROR
    InitializeGlobals
    Resume
    Case TYPE_MISMATCH
    lngSCAPTransID = 0
    Resume Next
    Case Else
    MsgBox "Error " & Err.Number & " : " & Err.Description, vbExclamation, "Error!"
    Resume Exit_Error_Handler
    End Select

    End Sub

    Private Sub cmdDocumentsRefresh_Click()
    Me.lstDocstoVerify.Requery
    Me.lstDocstoVerify = Null
    Me.txtDocumentNotes = Null
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Step debug. Follow the code as it executes. See if you can identify where behavior deviates from expected.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    EuniceH is offline Novice
    Windows Vista Access 2000
    Join Date
    Oct 2011
    Posts
    11

    solved

    What was happening was I had switched my front end to link to my backend using a mapped drive. I had to change that to the full server path, and things got back to normal.

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

Similar Threads

  1. Listbox update
    By Pgill in forum Forms
    Replies: 4
    Last Post: 07-25-2011, 11:42 AM
  2. ListBox RowSource Update Not working in 2003
    By Access0307 in forum Programming
    Replies: 1
    Last Post: 05-05-2011, 07:41 PM
  3. Refreshing/Requery bounded textboxes
    By jasonbarnes in forum Forms
    Replies: 4
    Last Post: 03-02-2011, 12:09 PM
  4. Replies: 3
    Last Post: 04-14-2010, 10:00 AM
  5. Replies: 6
    Last Post: 03-27-2010, 11:18 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