B
Brady Mann - Amatuer Extraordinaire
Hi all,
I'm new to the newsgroup and Access programming but, I'm learning
MUCH from you folks. Here is my situation.
I have a form (Access 2K)that I have protected from user entries via
Me.AllowEdits, Me.AllowAdditions, and Me.AllowDeletions = False. I also
have a combobox used to select the record the user would like to go to
(along with the usual button for "next" and "previous" record).
Here is the issue.
As you know, navigating with the combobox while Me.AllowEdits=False
is not possible. So, on the "Got Focus" event of the control I set
Me.AllowEdits = True. After this I use the "AfterUpdate" event to move
to the selected record (Me.Allow* is set back to False when the
Form_AfterUpdate event fires).
The trouble is, if the user clicks on the combobox and then clicks
somewhere else on the form, they are free to edit the record as
Me.AllowEdit = True at this point.
So here is my question: What can I do to programmatically recognize
that the user has just "abandoned" the navigation combobox? I need an
event of some kind to put in the "Me.AllowEdits=False" coding.
***code starts here
Private Sub cbo_SelectRecord_GotFocus()
Me.AllowEdits = True
End Sub
Private Sub cbo_SelectRecord_AfterUpdate()
On Error GoTo Exit_cbo_SelectRecord_AfterUpdate
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.Findfirst "[OppID] = " & Str(Me![cbo_SelectRecord])
Me.Bookmark = rs.Bookmark
Exit_cbo_SelectRecord_AfterUpdate:
Me.AllowEdits = False
Exit Sub
Err_cbo_SelectRecord_AfterUpdate:
msgbox Err.Description
Resume Exit_cbo_SelectRecord_AfterUpdate
End Sub
***code ends here
I'm new to the newsgroup and Access programming but, I'm learning
MUCH from you folks. Here is my situation.
I have a form (Access 2K)that I have protected from user entries via
Me.AllowEdits, Me.AllowAdditions, and Me.AllowDeletions = False. I also
have a combobox used to select the record the user would like to go to
(along with the usual button for "next" and "previous" record).
Here is the issue.
As you know, navigating with the combobox while Me.AllowEdits=False
is not possible. So, on the "Got Focus" event of the control I set
Me.AllowEdits = True. After this I use the "AfterUpdate" event to move
to the selected record (Me.Allow* is set back to False when the
Form_AfterUpdate event fires).
The trouble is, if the user clicks on the combobox and then clicks
somewhere else on the form, they are free to edit the record as
Me.AllowEdit = True at this point.
So here is my question: What can I do to programmatically recognize
that the user has just "abandoned" the navigation combobox? I need an
event of some kind to put in the "Me.AllowEdits=False" coding.
***code starts here
Private Sub cbo_SelectRecord_GotFocus()
Me.AllowEdits = True
End Sub
Private Sub cbo_SelectRecord_AfterUpdate()
On Error GoTo Exit_cbo_SelectRecord_AfterUpdate
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.Findfirst "[OppID] = " & Str(Me![cbo_SelectRecord])
Me.Bookmark = rs.Bookmark
Exit_cbo_SelectRecord_AfterUpdate:
Me.AllowEdits = False
Exit Sub
Err_cbo_SelectRecord_AfterUpdate:
msgbox Err.Description
Resume Exit_cbo_SelectRecord_AfterUpdate
End Sub
***code ends here