473,943 Members | 29,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

deleting data in a field doesn't seem to clear the field

43 New Member
Hi - I have a field on a form that is required. It's in a combo box. The combo box is set to Limit to List. Sometimes a user comes into the field and starts typing into the field to locate their record. But the record doesn't exist. So they backspace over the data they entered and try to leave the field (to go hit a button to add the record they need) and they get a message saying the field is required and can't be null. However, if they return to the field and then hit the escape key, they can exit the field without the error message. Backspacing over the data somehow doesn't leave the field blank, but hitting escape does. It's confusing for the user. Is there any way around this (allowing them to backspace and then not get this error)?

Thanks for your help
Sep 2 '09 #1
10 1790
bkberg05
43 New Member
At someone's suggesting on another question, I've tried the following, but am still getting the same validation error.

If Vendor_ID.Dirty = True Then
If Vendor_ID.Value = "" Then
Vendor_ID.Undo
End If
End If
Sep 2 '09 #2
ChipR
1,287 Recognized Expert Top Contributor
Just check for cboBox.ListInde x >= 0 to make sure they have selected a value and not blank.
Sep 2 '09 #3
kstevens
74 New Member
I am currently using this to do the exact same thing in the before update event
Expand|Select|Wrap|Line Numbers
  1. If IsNull([WorkOrderNumber]) Then
  2.     Me.Undo
  3.     Exit Sub
  4. End If
  5.  
And this if they continue (enter the entire number without backspacing out), and the record already exists
Expand|Select|Wrap|Line Numbers
  1. Dim TempWork As Integer
  2. If Nz(DCount("*", "tblOpenOrders", "WorkOrderNumber =" & Me.WorkOrderNumber), 0) > 0 Then
  3.     TempWork = Me.WorkOrderNumber
  4.     Me.Undo
  5.     DoCmd.ApplyFilter , "WorkOrderNumber =" & TempWork
  6. End If
  7. End Sub
Otherwise they are creating a new record.
Sep 2 '09 #4
bkberg05
43 New Member
Hi KStevens. Makes good sense on the BeforeUpdate.

The me.undo resets whole form though (takes it back to a new record and any data entered previously is lost). I tried fieldname.undo and then I still got the same error. Does it work for you if you specify the fieldname rather than using 'me'?
Sep 2 '09 #5
bkberg05
43 New Member
ChipR - thanks for the suggestion, but what do I do after I check this? The checking for null or "" seems to work for, but I can't seem to get the field back to an 'undirty' state so that the validation rule doesn't kick in.
Sep 2 '09 #6
ChipR
1,287 Recognized Expert Top Contributor
Is your combo box bound to a field in your table? I don't get this problem with an unbound combo box.
Sep 2 '09 #7
bkberg05
43 New Member
yes, it is bound. is that the wrong way to do it?
Sep 2 '09 #8
ChipR
1,287 Recognized Expert Top Contributor
Not necessarily, but I have found it easier to work with unbound combo boxes. It's a little more work, but you get an extra step of code and/or formatting between the combo box and the table. So in the AfterUpdate of my combo box, I would handle the validity check, and if the value was good, I would copy it to a hidden bound text box on the form.
Sep 2 '09 #9
missinglinq
3,532 Recognized Expert Specialist
IF it was me, I'd go back into the table and strip off the "required" property and then use Validation at the form level to insure a it has a value, using the Form_BeforeUpda te event. Keeps the field as "required" and eliminates the problem, I would think.

Linq ;0)>
Sep 2 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7797
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
2
2272
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having trouble making it work in SQL Server 2000. I am not a database newbie, but I can't seem to figure this one out so I am turning to the newsgroup. I am thinking that some of the SQL Gurus out there have done this very thing a thousand times before...
32
3247
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being lost when they move to a new record. This seems to be the case when there are multiple users. When there is a single user using it, we don't seem to have that problem. It seems that we had this problem when we first converted from an MDB back end...
3
2764
by: Nathan Bloom | last post by:
Hi, I have a data entry form (access 2000) that also allows the user to add, update, and delete records from the form. The Delete action is carried out in an event procedure and has the following code: Private Sub Command28_Click() On Error GoTo Err_Command28_Click
2
1722
by: SiouxieQ | last post by:
Hi there, I'm using the code below to try to delete a name from a list of names in a file. Unfortunately it doesn't quite do what I want it to. Instead of looking for the name in the textbox and deleting that it is just deleting the first line of data in the file.
6
2377
by: James | last post by:
Have a textbox that's in Password mode on a user creation page. Have several dropdowns that cause a PostBack out of necessity on this page. I cannot separate them. When one of these dropdowns changes, the textbox's value is lost. How do I prevent this? Thanks
29
4302
by: zoltan | last post by:
Hi, The scenario is like this : struct ns_rr { const u_char* rdata; }; The rdata field contains some fields such as :
4
3486
by: G .Net | last post by:
Hi I have a DataSet with several DataTables. I have set up relations between these tables. I want to delete all the tables and re-fill them. However, when I try to do so, even after using Relations.Clear() I still get excecptions, such as: Cannot remove ForeignKeyConstraint - remove the constraint first
11
3704
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
0
10135
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10662
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9865
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7390
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6308
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4910
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 we have to send another system
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3511
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.