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

October 27th, 2003, 05:10 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Checkbox Property Error
I am not new to Access, but I am new to programming VBA. The strange thing is that this does not appear to be a programming issue. I have a table that has the following fields (I input this data through a form):
Inspector - 'The clients Quality Control person (combo box uses Query)
Building - 'The location that a particular job is performed (Combo box uses query)
Date - 'the date the client inspected the work (MS Date and Time Picker)
Supervisor - 'My employee responsible for the building (combo box uses query)
Amount - 'Cost of work if not performed
Reperformance (CheckBox) - 'Check if the work has been reperformed.
I am getting the following error everytime I go to a new record:
"Can't set value to NULL when CheckBox property = False." (This error displays when I click new record and it also shows when the new record is displayed.)
After clicking OK to the error message, the record saves into the table just fine. I have looked at all the properties of the table, form and fields, but have been unable to determine the problem.
I also get this error message when I click the next button, but not everytime. Perhaps every fourth record while going through the table in form mode.
Thanks in advance for your help.
David
|
|

October 27th, 2003, 05:33 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Which field is giving you the trouble and what data type is the database field?
You may be setting a value to null in a tru/false database field. Try setting the value to false.
Are you doing some type of check for a null value in the checkbox?
Sal
|
|

October 28th, 2003, 10:49 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Sal,
I am not certain what field is giving me the problem, but it looks like it could be the date/time field. After I clicked the button to go to a new record, I would get the error twice, before the new record was displayed. After doing about 60 records, I discovered that some of the dates did not save (I used the MS Date and Time Picker for this field).
I do not know how I could be setting a value to null, and no I am not checking for null in the checkbox.
Thanks for your help,
David
p.s. Is there such thing as a checkbox property?
|
|

November 4th, 2003, 04:26 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
David,
Just to be sure, check the properties for the checkbox and look for a property named Triple State. If Triple State = Yes, it will allow a NULL value in a checkbox. Assuming that the checkbox is bound to a Yes/No field in an underlying Access table, this could also cause a problem when navigating to a new record. Yes/No fields (also called Boolean fields in other database platforms) can only have two values Yes/No or True/False - a NULL value could cause a problem.
Warren
|
|

October 16th, 2004, 03:23 PM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Just set your Date source field default value (In the Table design view) to Date(). This resolved the problem for me.
|
|

February 10th, 2005, 01:53 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I had the exact sam problem with ActiveX Control: DTPicker7. Everytime I went to a new record, I would get the "Can't set value to Null when CheckBox property = False"
To fix this, I went into the properties of the DTPicker7 and clicked on the "Other" tab and scrolled down to the "Checkbox" property which has a "No" value, and I changed it to a "Yes".
Problem solved!
Hope that helps!
|
|

February 10th, 2006, 05:43 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
BINGO! That solved it.
|
|
 |