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

Check for Null with comboboxes

hi guys,
I have form that contain three textbox,combobox and button.
I want that user must have to choose value from combobox or if combobox is empty and you clicked on button you should get message that you must have to choose value from combo box.
so what i should have to do.

i tried this on button click event .but it did,'t work

Expand|Select|Wrap|Line Numbers
  1. If (Forms!Form_Name![Combobox_Name].value = null) then
  2. msgbox "You must have to choose value"
  3. End If
----------------And------- this also-----------
Expand|Select|Wrap|Line Numbers
  1. If (Forms!Form_Name![Combobox_Name].value = " ") then
  2. msgbox "You must have to choose value"
  3. End If
And this works but not perfecyly when i choose value then it said type mismatch error

Expand|Select|Wrap|Line Numbers
  1. if nz(me.combobox_name,"" = "") then
  2. msgbox "you must have to choose value"
  3. End if


Thanks a Lot
Jun 17 '11 #1
2 8701
Try using..

Expand|Select|Wrap|Line Numbers
  1. If IsNull(me.combobox_name) then
  2. msgbox "You must have to choose value"
  3. End If
The nz() function creates a replacement value if the object is null so the reason it is working is that me.combobox is null so it replaces the value with "" = "" which returns true. Anouther way of doing is this is
Expand|Select|Wrap|Line Numbers
  1. If nz(me.combobox_name,"") = "" then
Jun 17 '11 #2
Thanks dear,
Great!its work nicely that i want
Jun 17 '11 #3

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

Similar topics

41
by: Alexei A. Frounze | last post by:
Seems like, to make sure that a pointer doesn't point to an object/function, NULL (or simply 0) is good enough for both kind of pointers, data pointers and function pointers as per 6.3.2.3: 3 An...
10
by: John | last post by:
Ok. I'm not sure whether this is cool or perverted, I need second opinion ;) I define two classes as follows: /********************************************/ public sealed class Dummy {...
3
by: vince | last post by:
I want to assign a null value to a DateTime variable.How do i do that? Thanks Vince
2
by: Lenard Gunda | last post by:
Hey, How can I assign 'null' value to a handle in C++/CLI? I searched for this for some while now, finding nothing so far. In C# I could write: something = null; or
2
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the...
1
by: susan.fitzpatrick | last post by:
In C# integers are automatically intialized to zero. I need to assign null to an integer (i.e. int i = null). I cannot use Nullable Types because that is a feature in .NET 2.0 and I need to use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.