Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 March 5th, 2007, 09:16 PM
Registered User
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting null value

i am getting null value for result1.
form1![port1] and form1![port2] are returning the query result.

Set form1 = Forms![insert incoming data items]

    If IsNull(form1![port2]) = True Then

        result1 = form1![port2]
        result1 = result1 + 1
    Else
        result1 = form1![port1]
        result1 = result1 + 1

    End If
    form1![Text1] = result1

any ideas.
my final aim is to increment the query result by 1 and display in other textbox.
 
Old March 6th, 2007, 09:00 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I don't understand what you are doing, or trying to do.

In psuedo code,

Take the value "insert incoming data items" from your form.

If "port2" is Null, then
   result1 = null
   increment result1 by 1 'increment a null?
Else if "port2" has some value, including empty string
   result1 = "port1"
   increment result1 by 1
End if

Display result1 in text1 on the form.

What are the values in the port fields? Are they integers? I don't think you can increment a null value by 1.

What should the query result look like?

mmcdonal
 
Old March 6th, 2007, 09:01 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

In response to your subject line, you can't really get a null value. You can check for null, but it doesn't have a value. Null has no value, and is not even equal to null.

mmcdonal
 
Old March 6th, 2007, 09:31 PM
Registered User
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

I am returning result of count query in port1 as well port2.
now, i want to compare that result, if port2 have value then is increment by 1 otherwise port1 will increment by 1 and display that result in text1.
port1 & port2 are list box
text1 is text box.
 
Old March 13th, 2007, 07:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Form1.Text1 = Nz(Form1.[port2], Form1.[port1]) + 1

And if Port1 is possibly null, you can set a default of, say, zero. In that case Text1 will be equal to one.

Form1.Text1 = Nz(Form1.[port2], Nz(Form1.[port1], 0)) + 1


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Null Value Yasho VB.NET 2002/2003 Basics 1 June 21st, 2007 04:37 AM
Null Ignored... Why? SerranoG Access VBA 13 December 28th, 2005 12:41 PM
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
Is A Null Different from Another Null ramk_1978 SQL Language 9 February 12th, 2005 03:18 PM
when to use is Null and =null and"null shoakat Classic ASP Databases 3 October 29th, 2004 01:47 AM





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