LeizladNeb
Technical User
I have a button in a sub form called [frmJob] which has been made from [tblJob]. The button runs the following code with the intention of finding the number of items in [tblItem] which have the same [JobNo], and also totalling their total values.
Private Sub Command28_Click()
[ItemsInJob] = DCount("[tblItem]![ItemNo]", "tblItem", "[tblItem]![JobNo]=[tblJob]![JobNo]"
[JobValue] = DSum("[TotalItemValue]", "tblItem", "[tblItem]![JobNo]=[tblJob]![JobNo]"
End Sub
An error returns on clicking the button:
'The object doesn't contain the Automation Object 'tblJob!JobNo."
The error doesn't occur and the code works fine when I open frmJob on its own, i.e. not as a subform, so im guessing its a reference thing. Any ideas?
Thanks Ben Dalziel
Private Sub Command28_Click()
[ItemsInJob] = DCount("[tblItem]![ItemNo]", "tblItem", "[tblItem]![JobNo]=[tblJob]![JobNo]"
[JobValue] = DSum("[TotalItemValue]", "tblItem", "[tblItem]![JobNo]=[tblJob]![JobNo]"
End Sub
An error returns on clicking the button:
'The object doesn't contain the Automation Object 'tblJob!JobNo."
The error doesn't occur and the code works fine when I open frmJob on its own, i.e. not as a subform, so im guessing its a reference thing. Any ideas?
Thanks Ben Dalziel