473,396 Members | 2,014 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,396 software developers and data experts.

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

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 1744
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 Expert 1GB
Just check for cboBox.ListIndex >= 0 to make sure they have selected a value and not blank.
Sep 2 '09 #3
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
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
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 Expert 1GB
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
yes, it is bound. is that the wrong way to do it?
Sep 2 '09 #8
ChipR
1,287 Expert 1GB
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 Expert 2GB
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_BeforeUpdate event. Keeps the field as "required" and eliminates the problem, I would think.

Linq ;0)>
Sep 2 '09 #10
Thanks linq and chipr. Don't know which method I'll choose (diplomatic), but I'm sure either one will solve me problem easily enough.
Sep 3 '09 #11

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

Similar topics

1
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:...
2
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...
32
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...
3
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...
2
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...
6
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...
29
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
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...
11
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)...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.