469,646 Members | 1,395 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Bugs in Clearing Form

I have an edit record form with several text boxes, combo boxes, and
check boxes. All of them are bound except for one combo box
(cboPositionData), which I use to search for a specific record. I
have a Clear button which I have coded to use the Me.undo if the form
is dirty. I am testing for a situation in which the user would stop
trying to enter data in cboPositionData and clear the form. When I
enter a partial value in cboPositionData and then hit Clear, it pulls
up a record or jumps to the next field. I have to click Clear again
before it will clear the form.

If I enter a full field value in cboPositionData and then click Clear,
I receive error 3020 in the Form_BeforeUpdate event saying that
"Update or CancelUpdate without AddNew or Edit". After I click OK on
the error message, I then have to click Clear again. I have also
tried calling a function to clear the form but with the same results.
Would anyone have any suggestions on how to deal with these two
different issues such that one click on Clear will clear the form,
including the cboPositionData control?

Thanks,
Alex
Nov 12 '05 #1
3 2002
Response below.

"Alex Wisnoski" <Al***********@ncmail.net> wrote in message
news:5c**************************@posting.google.c om...
I have an edit record form with several text boxes, combo boxes, and
check boxes. All of them are bound except for one combo box
(cboPositionData), which I use to search for a specific record. I
have a Clear button which I have coded to use the Me.undo if the form
is dirty. I am testing for a situation in which the user would stop
trying to enter data in cboPositionData and clear the form. When I
enter a partial value in cboPositionData and then hit Clear, it pulls
up a record or jumps to the next field. I have to click Clear again
before it will clear the form.

If I enter a full field value in cboPositionData and then click Clear,
I receive error 3020 in the Form_BeforeUpdate event saying that
"Update or CancelUpdate without AddNew or Edit". After I click OK on
the error message, I then have to click Clear again. I have also
tried calling a function to clear the form but with the same results.
Would anyone have any suggestions on how to deal with these two
different issues such that one click on Clear will clear the form,
including the cboPositionData control?


The code behind your "cboPositionData" combo box is executing before the Undo
method is invoked because the control is being updated when the focus is moved
to the command button. To avoid this, the combo box text entry would need to be
undone before leaving the same and, offhand, I can only think of using the
"Escape" key to do this. The other alternative might be to use a form where
*all* the controls were unbound and, using code, populate the form and update
the records to avoid undesired updates.

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2
This isn't perfect, but have you thought about disabling the clear
button on the combo's got focus event & re-enabling it when the combo
loses focus? You can handle an incorrect entry before re-enbling the
button.

Neil
Nov 12 '05 #3
"Bruce M. Thompson" <bthmpson@big_NOSPAM_foot.com> wrote in message news:<10*************@corp.supernews.com>...
Response below.

"Alex Wisnoski" <Al***********@ncmail.net> wrote in message
news:5c**************************@posting.google.c om...
I have an edit record form with several text boxes, combo boxes, and
check boxes. All of them are bound except for one combo box
(cboPositionData), which I use to search for a specific record. I
have a Clear button which I have coded to use the Me.undo if the form
is dirty. I am testing for a situation in which the user would stop
trying to enter data in cboPositionData and clear the form. When I
enter a partial value in cboPositionData and then hit Clear, it pulls
up a record or jumps to the next field. I have to click Clear again
before it will clear the form.

If I enter a full field value in cboPositionData and then click Clear,
I receive error 3020 in the Form_BeforeUpdate event saying that
"Update or CancelUpdate without AddNew or Edit". After I click OK on
the error message, I then have to click Clear again. I have also
tried calling a function to clear the form but with the same results.
Would anyone have any suggestions on how to deal with these two
different issues such that one click on Clear will clear the form,
including the cboPositionData control?


The code behind your "cboPositionData" combo box is executing before the Undo
method is invoked because the control is being updated when the focus is moved
to the command button. To avoid this, the combo box text entry would need to be
undone before leaving the same and, offhand, I can only think of using the
"Escape" key to do this. The other alternative might be to use a form where
*all* the controls were unbound and, using code, populate the form and update
the records to avoid undesired updates.


Thanks for your response and suggestions. I am going to give serious
thought to changing my form to unbound. I am beginning to get the
distinct impression that bound forms are fine until what I am trying
to accomplish gets a little involved. At that point I think the
unbound form becomes 'simpler' to reach my objective. Thanks again
for your help.

Alex
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jeff Levinson [mcsd] | last post: by
2 posts views Thread by Savvas | last post: by
3 posts views Thread by Alex Wisnoski | last post: by
3 posts views Thread by Brad | last post: by
2 posts views Thread by John Smith | last post: by
1 post views Thread by Shahid Juma | last post: by
1 post views Thread by scprosportsman | last post: by
19 posts views Thread by Alan Silver | last post: by
1 post views Thread by Vayse | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.