pbuethe
Returning User
- Local time
- Today, 16:59
- Joined
- Apr 9, 2002
- Messages
- 210
My data entry was working fine (I thought) but suddenly today, whenever I start to enter data in a new subform record (single form) I get the invalid use of null error.
(I can add subform records if the main record already has related records, but I can no longer add related record #1 on a new or existing main record.) The error occurs in the code below which is to generate the next sequential test_id # in tblTests.
tblTests has a many-to-one relationship with tblReviews and is related by the field CaseNbr which is the pk of tblReviews as well as a field in tblTests and on the form. cboTestID is a combo box from which to select existing test records.
The invalid use of null error happens on
the line starting i = DMax...
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim i As Integer
i = DMax("[Test_ID]", "tblTests", "[tblTests].[CaseNbr] = " & Me![CaseNbr]) + 1
Me!Test_ID = i
Me!cboTestID = i
End Sub
I have to hand the database off to someone else this week so I would like to solve this soon!
Thanks for any assistance.
(I can add subform records if the main record already has related records, but I can no longer add related record #1 on a new or existing main record.) The error occurs in the code below which is to generate the next sequential test_id # in tblTests.
tblTests has a many-to-one relationship with tblReviews and is related by the field CaseNbr which is the pk of tblReviews as well as a field in tblTests and on the form. cboTestID is a combo box from which to select existing test records.
The invalid use of null error happens on
the line starting i = DMax...
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim i As Integer
i = DMax("[Test_ID]", "tblTests", "[tblTests].[CaseNbr] = " & Me![CaseNbr]) + 1
Me!Test_ID = i
Me!cboTestID = i
End Sub
I have to hand the database off to someone else this week so I would like to solve this soon!
Thanks for any assistance.