473,508 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2173
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
1140
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
2872
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
1836
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
392
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
15041
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
1696
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
1269
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
4245
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
2174
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
1736
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
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
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
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.