Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
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 August 17th, 2005, 07:00 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

That's because when you place the mouse over the LkUp, you're getting the value for that variable, e.g. 1234. However, when you move over slightly and place your mouse over the IsNull part of the IsNull(LkUp), THAT expression evaluates to TRUE. In VBA TRUE is equivalent to -1. False = 0. So you're fine.

You have to decide what to set the checkboxes for when you're starting out with no data. Go to your table where the Yes/No fields exist and set their defaults to FALSE if you don't want the true part the code to fire up. Also, set the checkboxes at the form to default to FALSE, too.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 17th, 2005, 07:02 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

More specifically, when you first start out, LkUp is null so hovering over the IsNull function while debugging gives you -1, or TRUE. When it actually gets a number, hovering over the LkUp give you a number, e.g. 1234 and the IsNull is now FALSE, or zero.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 17th, 2005, 09:06 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I changed the default values in both the table and the form as follows:
in = true, and out = false. The first and second new records work as expected, from then on, all records are marked "out".

 
Old August 17th, 2005, 01:12 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

Try putting this near the top on the form's ON CURRENT event:

If Me.NewRecord Then
    Me.chkIn = True
    Me.chkOut = False
End If


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 17th, 2005, 02:18 PM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did, and after each entry a message is displayed "tblInYArd.EmpNum the field cannot contain a null value because of the requeired property is set to true. enter a value in this field." I dismiss the message and the text box gets the focus, I input another number and the same error again. If I change the required field to No in the table, the message is not displayed, but the numbers are not recorded on the table and all "in" boxes are checked.

 
Old August 18th, 2005, 07:03 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

Is your form bound to the same table where the employee number is stored? Are you working in a subform without parent/child links in tact? Hard to tell without seeing the database.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 18th, 2005, 08:08 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, the form is bound to the table where the numbers are being recorded, and there are no subforms.
I know you are a busy person, but if you don't mind the intrusion I can send you the database for you to see it.
Thanks for your help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
dlookup problem alemok Access 0 April 17th, 2008 02:50 AM
Problem with Dlookup JAdkins Access VBA 1 January 11th, 2008 06:52 PM
Help with DLookup Devilboy13 Access VBA 4 August 30th, 2006 02:48 PM
DLookup Teqlump Access VBA 1 August 9th, 2006 11:48 PM
Dlookup with If ..Then ..Else and Chkboxes ecampos Access VBA 1 August 19th, 2005 01:51 PM





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