 |
| 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
|
|
|
|

August 17th, 2005, 07:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
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
|
|

August 17th, 2005, 07:02 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
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
|
|

August 17th, 2005, 09:06 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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".
|
|

August 17th, 2005, 01:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
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
|
|

August 17th, 2005, 02:18 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

August 18th, 2005, 07:03 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
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
|
|

August 18th, 2005, 08:08 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |