spikepl
Eledittingent Beliped
- Local time
- Today, 22:58
- Joined
- Nov 3, 2010
- Messages
- 6,142
I have this cancel handler attached to a button on a split form:
If I click my button, everything works fine. The button has .Cancel=True.
If I press ESC, then my form goes blank, showing no record. If I try to set focus to some field in a record (in SetControls), Access comes up with : Rutime error 2105 - you cannot go to specified record.
So I put a break-point just before calling SetControls... and when I hit the break-point I just press Continue - and everything works just fine.
So it must have something to do with what is updated and when - but I am sort of stuck.
Any ideas?
Code:
Private Sub cmdFortryd_Click() ' my cancel button handler
Me.Undo
Me.AllowAdditions = False ' resetting the form
Me.tglEditKunde.Enabled = True ' showing that we no longer are in edit mode (which we weren't anyway, when canceeling new addition'
Me.tglEditKunde = False
Me.tglNyKunde.Enabled = True 'enabling key to add a new customer
Me.tglNyKunde = False 'settting the value of the "New customer" toggle to false
Me.DataEntry = False 'setting the form back to normal view
Me.Refresh ' playng with updates
Me.Requery 'playing with updates
Me.Repaint 'playing with updates
Call SetControls("None") 'resetting various other controls to noneditable status (and shifting foucs form cancel key, to be able to disable it
Me.cmdFortryd.Enabled = False ' disabling my CANCEL-key
Me.cmdDone.Enabled = False ' disabling the DONE-key.
End Sub
If I press ESC, then my form goes blank, showing no record. If I try to set focus to some field in a record (in SetControls), Access comes up with : Rutime error 2105 - you cannot go to specified record.
So I put a break-point just before calling SetControls... and when I hit the break-point I just press Continue - and everything works just fine.
So it must have something to do with what is updated and when - but I am sort of stuck.
Any ideas?