argument required????

CHAOSinACT

Registered User.
Local time
Tomorrow, 00:10
Joined
Mar 18, 2009
Messages
235
i have a script here:

Public Sub LoadMaterialsUsed()
If Form_frmCivilMinorJobs.toggleQuoteOnly.Value = False Then
'total of materials cost
Dim curTotalMaterials As Currency
'recordset application variable
Dim rsCivilCostCurrentJobMaterials As ADODB.Recordset 'bill types

Set rsCivilCostCurrentJobMaterials = New ADODB.Recordset
rsCivilCostCurrentJobMaterials.ActiveConnection = CurrentProject.Connection
rsCivilCostCurrentJobMaterials.Source = "qryCivilCostCurrentJobMaterials"
rsCivilCostCurrentJobMaterials.CursorType = adOpenDynamic
rsCivilCostCurrentJobMaterials.LockType = adLockOptimistic
'open costing recordset
rsCivilCostCurrentJobMaterials.Open
rsCivilCostCurrentJobMaterials.MoveFirst
Do While rsCivilCostCurrentJobMaterials <> EOF
curTotalMaterials = curTotalMaterials + rsCivilCostCurrentJobMaterials!TotalSpent
rsCivilCostCurrentJobMaterials.MoveNext

Loop

If curTotalMaterials <> "" Then
Form_frmCivilMinorJobs.txtMaterials_used.Value = curTotalMaterials
If Form_frmCivilMinorJobs.chkExcelQuoteAvailable.Value = True Then
Form_frmCivilMinorJobs.txtMaterials_remaining.Value = Form_frmCivilMinorJobs.txtMaterials.Value - curTotalMaterials
Else
Form_frmCivilMinorJobs.txtMaterials_remaining.Value = Form_frmCivilMinorJobs.txtManualMaterials.Value - curTotalMaterials
End If


End If

rsCivilCostCurrentJobMaterials.Close
Set rsCivilCostCurrentJobMaterials = Nothing
End If
End Sub

now everytime it hits this and loads it stops at the top (public sub) and says "argument not optional" ...darned if i was aware of any argument being needed here esp in the top of it as it has nothing passed to it.... anyone see what i'm missing? thanks.
 
I don't know about your parameter error, but couldn't you replace all of this ...
Code:
'recordset application variable
Dim rsCivilCostCurrentJobMaterials As ADODB.Recordset 'bill types

Set rsCivilCostCurrentJobMaterials = New ADODB.Recordset
rsCivilCostCurrentJobMaterials.ActiveConnection = CurrentProject.Connection
rsCivilCostCurrentJobMaterials.Source = "qryCivilCostCurrentJobMaterials"
rsCivilCostCurrentJobMaterials.CursorType = adOpenDynamic
rsCivilCostCurrentJobMaterials.LockType = adLockOptimistic
'open costing recordset
rsCivilCostCurrentJobMaterials.Open
rsCivilCostCurrentJobMaterials.MoveFirst
Do While rsCivilCostCurrentJobMaterials <> EOF
curTotalMaterials = curTotalMaterials + rsCivilCostCurrentJobMaterials!TotalSpent
rsCivilCostCurrentJobMaterials.MoveNext

Loop
... with this ...
Code:
curTotalMaterials = DSum("TotalSpent", "qryCivilCostCurrentJobMaterials")
And the problem you're posting about: Is that a compile error or does the execution halt at the line you indicated?
Cheers,
 
halts at public sub line! makes little sense
 

Users who are viewing this thread

Back
Top Bottom