Requery not showing table or record changes

R

Robert Vivian

I have several listboxs that are all exhibiting the same behavior. Each
change to a record or record addition fails to show up in the list boxes
until the next change or addition occurs, even though I am using the the
Requery method on the controls and a form Refresh method after the update to
a linked table that is the source of the rowsource queries. The net reesult
is that the listboxes always display one change behind. I am using Access
2000 running under XP. Sample code follows:

Private Sub cmdDismissCurrent_Click()
Dismiss listCurrent, cstDismiss
listCurrent.Requery
listDismissed.Requery
Me.Refresh
End Sub
Public Sub Dismiss(ctlSource As Control, intAction As Integer)
Dim rstTemp As DAO.Recordset
Dim lngPkey
'Open a temporary recordset and seek to the record whose primary key
'corresponds to the currently selected list item
Set rstTemp = dbsAlert.OpenRecordset("Alert", dbOpenTable)
lngPkey = GetSelectedKey(ctlSource)
'Dismiss or undismiss depending on action parameter
With rstTemp
.Index = "PKey"
.Seek "=", lngPkey
.Edit
Select Case intAction
Case cstDismiss
!Dismissed = True
Case cstUndismiss
!Dismissed = False
End Select
.Update
End With
End Sub
 
J

John Spencer (MVP)

Check the form's recordset type property. If it is set to DynaSet Inconsistent
updates, try changing it to Dynaset.

You may find that is the problem. If not, I have no other suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top