Error Message - How to Eliminate It?

wilderfan

Registered User.
Local time
Today, 12:30
Joined
Mar 3, 2008
Messages
172
..........
 
Last edited:
After using a combo box on a form, I get the following error message:

Can’t set Value to NULL when Checkbox property = FALSE

I’d like to get rid of this error message, if possible.


I have attached a file showing the contents of the table CorpNames.


In spite of the number of records, the table CorpNames reflects only 2 corporations. But these corps have gone through several name changes.

The form is meant to record new name changes and includes: a combo box (to select from the existing or current corporate names); a text box to input the new corporation name; and a date picker to record the EffectiveDate of the name change. (NOTE - The combo box is based on a query which returns only 2 records from the above table: the record for A4 Inc. and the record for B5 Ltd.)

As for the error message, I’m not sure if I need to adjust one of the properties of the table’s fields. Or whether I need to adjust one of the controls of the form.

Any suggestions?
 

Attachments

  • CorpNames.jpg
    CorpNames.jpg
    28.6 KB · Views: 103
can you show us the code for the combobox? if possible tell us where the code stops. and tell us what the checkbox is for.
 
Oddly enough, the VB Code listed for my form does not seem to include anything for the combo box. Don't know why that is.

Here is the VB code for the form:

Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub


The combo box is actually based on a Query. I wonder if that is why the combo box VB code is missing.

I've attached some screen prints to show the sequence of events when I try to record a name change.
 

Attachments

  • CorpNames2.jpg
    CorpNames2.jpg
    25.2 KB · Views: 90
wilderfan,

Can you give us information about which fields on your form are bound to which table/column?

Does this only happen on a new record or does it happen when you modify an existing record?

A combo-box shouldn't have a check-box property so I suspect you have a rogue control or have inaccurately set a column property of a table. There's no telling.

Is this database small enough to upload? How To Upload A Database To The Forum
 
Hi, George.

I have to run off to a family function right now. In a few hours, I will return and do as you suggested - try to upload the db, as it is relatively small.

Thanks.


-- Robert
 
This error occurs when a Yes/No database field is set as Required ...Yes, this field is part of the Combo Box entry fields, and the checkbox has not been clicked. You can put code in the BeforeUpdate of the combobox field to confirm all the required fields have been entered.
Smiles
Bob
Afterthought, you could set a default value to the yes/no field in the database definition.
 
Geroge. we will have to wait for Wilderfan to get back. I think the new database record has a required Yes/No field that may not be in the combo box fields. So when the new record add is attempted, the Required rule fails on the Yes/No field and thereby the combo box gets the weird message.
EG: Table
Company name....text
Name Active ... Yes/No Required = yes, default not specified
Smiles
Bob
 
The zipped file is attached.

Hope this helps to clarify the situation.

Thanks in advance for any assistance you can offer.


-- Robert


PS Do you think it would be worthwhile using the FQ2 query to create a new table that simply lists the current names in use (as oppposed to the entire history of corporate names which appears in the CorpNames Table)?
 

Attachments

Hi,
The checkbox error message is coming from the Datepicker. I have to go to bed, but was able to identify the source. I'm fishing tomorrow, so hopefully someone else can pick this up and help you resolve it.
Bob
 
Thanks MagicMan.

I have changed the CheckBox setting and that does eliminate the error message.

However, the formatting of the DatePicker field is not visually pleasing, as the checkbox shows up and the default (current) date appears unhighlighted.

Also, tabbing to the DatePicker field does not appear to work. I had to click on that field before the default date became highlighted / active.

Finally when I right-clicked on the DatePicker field (in Design view) and selected DatePicker Object Properties and then Help, I received a message indicating that my pc was missing the file

C:\windows\system32\cmctl298.chm

Any idea where I can download a safe copy of this file? I suppose I may need to register or activate it to get it to work when I click on the help button.
 

Attachments

It seems you are using "DTPicker" as an OLE control. That could be your problem. From http://mc-computing.com/Databases/MSAccess/Calendar_Example.html#DTPicker:

This control should be available on machines that have one of the Microsoft compilers installed - VisualBasic, VisualC++ and the like. Be careful, my previous experience with another ActiveX control indicates that it is fairly easy to get these to work on machines where Visual Studio is installed, but almost impossible to use them on other machines.

See the rest of the warnings there.

Why are you using this particular control?
 
Hi, Geroge.

The only reason I'm using DTPicker is that the person who introduced me to Access used it.

I'm certainly open to the idea of using other (similar) controls. I noticed that your link also included comments regarding Calendar Control.

Would this control do essentially the same thing? [NOTE: I have to build the db in ACCESS 2003.]


Regards,

Robert
 
I was leaning on the expertise of the author of that site. He recommends another tool and my guess is that it will work. The funny thing is, I've always considered myself weak on date/time questions but thought this was a control error problem, which is why I joined in.

Try it out and let us know if his other recommended tool works.
 
Hi, George.

I tried Calendar Control, but it has its own set of problems.

Unlike DatePicker, it does not provide a visual calendar. Instead it provides dropdown lists.

The major problem (see the attached zipped file) is that the control does not appear to offer a "Days" dropdown list.

Very strange.


-- Robert
 

Attachments

I'm so sorry. My poor users all type in their values (in the few instances that they aren't defaulted).

2007 has all this stuff automatically. I'm sure there are calendar controls for sale out there that have support and accomplish what you want.
 

Users who are viewing this thread

Back
Top Bottom