Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2005, 12:19 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default Testing for NULL Values in a Combo Box

I have a combo box on a form which may sometimes have a null value in it. There is no way around that. It's complicated. Please just take my word for it.

Is there a way to test for a null value in it?

IsNull(me.ComboBox1.Value) isn't working. It's thowing an error, saying, "you entered an expression that has no value".

Thanks.

Aaron

 
Old September 23rd, 2005, 12:32 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Aaron,
do you have your combo box set to limit to list?

Kevin

dartcoach
 
Old September 28th, 2005, 09:37 AM
ru1 ru1 is offline
Authorized User
 
Join Date: Feb 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok bud. Here you go:

If isnull(me.ComboBox1.Column(0))

The column function will examine each item in your combo list. It is zero relative, but don't let that scare you. All that means is that the first item in your list starts at 0 and the second one will be 1 and so on.

Also, you can use the column function to set values you have dim or other values in your form. Example:

Dim strItem1 as String

strItem1 = Me.ComboBox1.Coulmn(0)
if isnull(strItem1) then
.
.
.
.
endif

txtItem2 = Me.ComboBox1.Coulmn(1)
'Seeing that maybe txtItem2 is a test Box on your form.

I hope this helps out. Please let me know.

Ru1








Similar Threads
Thread Thread Starter Forum Replies Last Post
Show all values in a combo box in a report Odeh Naber Access 3 July 24th, 2007 07:37 AM
values in combo box Vince_421 Access VBA 8 May 10th, 2007 08:46 AM
combo box saves Number of Values JpaulH Access VBA 2 May 3rd, 2006 06:55 AM
Combo box with different display and send values iniro VB.NET 2002/2003 Basics 3 November 9th, 2004 12:34 PM
Using values from a combo box as variables in SQL SoC Classic ASP Basics 7 July 20th, 2004 03:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.