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
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