473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2165
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeff Levinson [mcsd] | last post by:
Not as far as I know. The easiest way is just to create a loop to set all of the controls values to "". You'll probably have to use a typeof statement to come up with specific clearing methods for...
2
by: Robin | last post by:
Ok, I have a form that on clicking of the Update button first updates the specific record in the db, then Inserts if the vMemo field is not empty. The problem that I'm having is that After...
2
by: Savvas | last post by:
Hi everybody, I have a lot of textboxes on my form and a "Clear" button. Is there a way with a for loop or something to clear the textboxes, instead of writing textboxName.clear? Thanks a lot
3
by: Alex Wisnoski | last post by:
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...
3
by: Brad | last post by:
I'm working with a DataGrid in C#, and the user needs to be able add and remove columns from the DataGrid on the fly, without opening and closing the form. The scenario is this. I have a setup...
2
by: John Smith | last post by:
Hi folks, I have a form with ASP.NET web controls. At the end of the form there's the "Clear" button to clear the available values and start over. How do I do that? The following did not work...
1
by: Shahid Juma | last post by:
Hi, I have a form and when the user clicks save, it will add all the details to the database. However, when I add it to the database, how do I clear the form values? What happens is that it...
1
by: scprosportsman | last post by:
Please help guys, i am trying to set up a database here at work and im fairly new to access in terms of writing functions and queries and stuff. I have 2 different places on my design that will...
19
by: Alan Silver | last post by:
Hello, Having discovered what I believe to be two CSS bugs in IE7, I have submitted bug reports to MS. AFAIK, these don't get acted on until they receive votes form others to say they are worth...
1
by: Vayse | last post by:
I have a databound form, frmClients. One of the field is a combo box, comDepartment, which lets a user select a department for the Client. But I can't figure out how to clear the box. That is,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.