473,395 Members | 1,474 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,395 software developers and data experts.

Checkbox checking for null or blank field prior to msgbox popup not working

The following code works for one checkbox with same code with different checkbox and textbox names, however this one brings up the msgbox even if the required field it is checking DOES have text in it.

CkPhoneListOther is a checkbox
PhoneListName_Pos is a textbox
Both are bound to fields in the table

Expand|Select|Wrap|Line Numbers
  1. CkPhoneListOther_AfterUpdate()
  2. If CkPhoneListOther = -1 and Nz(PhoneListName_Pos, "") = "" then
  3. Cancel = true
  4. Msgbox "you must enter a name or position"
  5. PhoneListName.setfocus
  6. End If
  7. End sub
  8.  
Why is it not checking the field to see if it has data?

thanks,
Jason
Apr 11 '13 #1
3 1243
Seth Schrock
2,965 Expert 2GB
In the title, you say you are checking for the checkbox to be null OR the field being blank. Your IF statement isn't checking for Null, it is checking for True. And your comparison is using the AND, not the OR. So I'm not exactly sure what you are wanting. Here is the code that I would use to match your title.
Expand|Select|Wrap|Line Numbers
  1. If IsNull(CkPhoneListOther) OR PhoneListName_Pos & "" = "" Then
Apr 11 '13 #2
Sorry, let me clearify. If the checkbox CkPhoneListOther gets checked and the PhoneListOther text field is blank or null, then I need a msgbox to appear. If the PhoneListOther text field is not blank or null then the user should be able to check the checkbox without any msgbox poping up.

Hope that makes more sense
Jason
Apr 11 '13 #3
Seth Schrock
2,965 Expert 2GB
Much more sense. Try
Expand|Select|Wrap|Line Numbers
  1. If CkPhoneList = True AND PhoneListName_Pos & "" = "" Then
Apr 11 '13 #4

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

Similar topics

2
by: Maziar Aflatoun | last post by:
Hi everyone, I am reading and displaying data rows from my database where the first column contains the Status checkbox. I like to enable my users to change the status of individual rows by...
10
by: Jerim79 | last post by:
I am working on form validation. I have a scheme that is working for me, except for 3 input fields. Zip, Phone, and Fax are the input fields. I want to do two tests. First I want to check to make...
1
by: klove1209 | last post by:
Good afternoon, I am currently working on this unbounded form that has numerous date fields. I wanted to know if it is possible to save data in a form, with a null date field. I am currently...
3
by: martin DH | last post by:
Hello, In a report, for every record, I would like a checkbox to appear checked if a certain field contains any value. The field is Client_comments. (memo field) I added a checkbox called...
5
by: shredder249 | last post by:
Hi, im trying to run an update SQL statement which sets the flag (queryident) to ticked if the track title field in that record is blank. However using '' to indicate a blank field does not work. Any...
6
by: maxx429 | last post by:
I am trying to check if notes have been added to a Memo field on a form if certain other fields have changed. Example: If the user ticks a particular check box on the form, I want to force them to...
6
by: ndeeley | last post by:
Hi, How do I insert a null or blank field into a database using coldfusion? I'm new to CF and its proviing a bit tricky! My database date field accepts null values (I think - theres no default...
0
by: sai krishna | last post by:
Hi All, Here is the issue java object has date fields that are null, I need to marshal an xml using jaxb, but jaxb doesn't allow null values when it marshal's. Is there any way to tell jaxb that...
1
by: jrlittle86 | last post by:
I know I'm overlooking something very simple but How can I check if the text within an XML tag is blank? The code below works fine as long as there are values within an XML node (For example the...
1
by: evilbungle | last post by:
Hi, I am sure this should be easy but can't get it working, I have a database which needs to import fields from a spreadsheet, I can open the spreadsheet and load the fields I want to into an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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...

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.