0
votes

I have a acces Form in which you can select a User with a dropdown Then i have a subform with all the licenses of that user. The licenses can be removed from that user with a button. After a license has ben removed i want to refresh the form, so that it actually disapears.

I think the Form_Dirty Event is the right one to trigger the refresh. I tried:

Private Sub Form_Dirty(Cancel As Integer)
    MsgBox "deleted a license"
End Sub

and the box shows up on every deletion. so i know that event fires. perfect. Buuuut whatever refresh command i put into that function it doesnt refresh. I tried:

    Me.requery
    Me.Recalc
    Me.refresh
    Forms.user.Form.requery
    Forms.user.licenses.Form.requery

it just stays the same. If i press F5 then it refreshes. How can that be?

1
Why don*t you delete from subforms recoordset? Where is the button (sub or parent)? - ComputerVersteher
Its on the subform. But its not strictly speaking a deletion rather i set the record to inactiv and then it gets filtered out by the query which is the datasource of the subform... - Stephan Graf
UseMe.Requeryafter the update of inactive flag at end of button. - ComputerVersteher

1 Answers

0
votes

Try using the AfterUpdate event of the subform:

Private Sub Form_AfterUpdate()
    If Me!Active.Value = False Then
        Me.Requery
    End If
End Sub

Edit. Or:

Private Sub Active_AfterUpdate()
    If Me!Active.Value = False Then
        Me.Dirty = False
        Me.Requery
    End If
End Sub