Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
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
  #12 (permalink)  
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
  #13 (permalink)  
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".

  #14 (permalink)  
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
  #15 (permalink)  
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.

  #16 (permalink)  
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
  #17 (permalink)  
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.

Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.