G
Geoff
Hi everyone,
I have written the code below and whenever it runs I get a compile error,
"Object Required" and when I chose to debug, the highlighted line is 'set
totfullday = me.daytotal'. I've tried testing out what exactly the problem
is by running some code that just has the DIM and SET statement similar to
below, and I get the same error. Obviously I'm missing something very stupid
but I can't see what. I've researched this and many people say to ensure the
DAO recordset is active, and I have made sure it is.
There is other code right above this which works fine and some of it was
given to me by someone else, and the first line is:
Private Sub Form_BeforeInsert(Cancel As Integer)
I don't know what 'cancel as integer' means but could that be causing this
problem? Just a thought, as anything with the word 'cancel' in must be
suspicious.
I'm sure some of the rest of the code is wrong too but I'll work on that.
I'm just trying to sort this out bit by bit so I can understand it. However,
if anyone fancies going through the rest of the code and telling me what
else is wrong, I wouldn't complain.
----------
'Setup variables
Dim totfullday As Single
Dim a As Byte
'Set focus to first subform record
DoCmd.GoToRecord , , acFirst
'Set totfullday to daytotal in first subform record
Set totfullday = Me.daytotal
For a = 1 To (Me.RecordsetClone.RecordCount) - 1
'Set focus to next subform record
DoCmd.GoToRecord , , acNext
'Set totfullday to what it was plus daytotal for next subform record
Set totfullday = totfullday + Me.daytotal
Next a
[runtotal] = totfullday
I have written the code below and whenever it runs I get a compile error,
"Object Required" and when I chose to debug, the highlighted line is 'set
totfullday = me.daytotal'. I've tried testing out what exactly the problem
is by running some code that just has the DIM and SET statement similar to
below, and I get the same error. Obviously I'm missing something very stupid
but I can't see what. I've researched this and many people say to ensure the
DAO recordset is active, and I have made sure it is.
There is other code right above this which works fine and some of it was
given to me by someone else, and the first line is:
Private Sub Form_BeforeInsert(Cancel As Integer)
I don't know what 'cancel as integer' means but could that be causing this
problem? Just a thought, as anything with the word 'cancel' in must be
suspicious.
I'm sure some of the rest of the code is wrong too but I'll work on that.
I'm just trying to sort this out bit by bit so I can understand it. However,
if anyone fancies going through the rest of the code and telling me what
else is wrong, I wouldn't complain.
----------
'Setup variables
Dim totfullday As Single
Dim a As Byte
'Set focus to first subform record
DoCmd.GoToRecord , , acFirst
'Set totfullday to daytotal in first subform record
Set totfullday = Me.daytotal
For a = 1 To (Me.RecordsetClone.RecordCount) - 1
'Set focus to next subform record
DoCmd.GoToRecord , , acNext
'Set totfullday to what it was plus daytotal for next subform record
Set totfullday = totfullday + Me.daytotal
Next a
[runtotal] = totfullday