Error msg not accepting null value when there are no null values

S

steveman2000

Two forms A and B. Form A opens form B and form B contains a sub form. After
setting a public variable on A to true (to indicate add record) then opening
form B using a command. Form B on load checks the variable and if its set to
true executes the go to add record. It then executes several insert queries
which after calling a form refresh fills up the sub form. However when teh
form refresh command is executed an error message comes up saying check box
value cannot be set to false when null which is teh message that i get when a
field is illegally null (there are no check box fields in the sub form (or
teh main form). After clicking ok there are no problems. I have checked the
the fields in teh underlining tables are not set to required and are
appropraitely set to allow empty value.

I've been on this bug for a long time and even though the form can be used
after clicking ok its still very annoying.

Please help, Thanks
 
J

John Vinson

Two forms A and B. Form A opens form B and form B contains a sub form. After
setting a public variable on A to true (to indicate add record) then opening
form B using a command. Form B on load checks the variable and if its set to
true executes the go to add record. It then executes several insert queries
which after calling a form refresh fills up the sub form. However when teh
form refresh command is executed an error message comes up saying check box
value cannot be set to false when null which is teh message that i get when a
field is illegally null (there are no check box fields in the sub form (or
teh main form). After clicking ok there are no problems. I have checked the
the fields in teh underlining tables are not set to required and are
appropraitely set to allow empty value.

I've been on this bug for a long time and even though the form can be used
after clicking ok its still very annoying.

Please help, Thanks

Please post the exact text of the error message, and the relevant
code.

John W. Vinson[MVP]
 
S

steveman2000

This is the code for form B (the one that opens and has an eror message on
it). The error message only comes up when you click in the sub form.

The error message is the following:
"Can't set Value to NULL when CheckBox property = FALSE"

Private Sub Form_Load()
If QUOT_ADD = True Then
DoCmd.GoToRecord , , acNewRec
dateQuoteDate.Value = Date
Me.ProjId = QUOT_PROJ_LINK

For i = 8 To 14
strSQL = "INSERT INTO tblQuotCategories (QuotId, QuotCatId,
EstDate, [Percent], ProjId) VALUES (" & Me.QuotId & ", " & i & ", " & Date &
", " & 0 & ", " & Me.ProjId & ");"
Set dbDefault = CurrentDb
dbDefault.Execute (strSQL)
Next i
Me.subQuote.Requery

cboCompany_Change
QUOT_ADD = False
Else
cboCompany_Change
End If

cboCompany.SetFocus
End Sub
 
Top