Junior said:
Thanks Tina
That helped some - but now i get a runtime error 3061 - too few
parameters
If QDelaySum is itself a query, probably that query has parameters --
for example, references to controls on forms, such as are often used in
criteria -- which are not resolved automatically by the DAO
OpenRecordset method. To get a recordset from a parameter query, try
doing it like this:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Dim strSVCID As String
Dim strSQL As String
' ... get strSVCID from somewhere ...
strSQL = "SELECT * FROM QDelaySum " & _
"WHERE ServiceID = '" & strSVCID & "'"
Set db = CurrentDb
Set qdf = db.CreateQueryDef("", strSQL)
With qdf
For Each prm In .Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rs = .OpenRecordset
End With
With rs
' ... do stuff with rs ...
.Close
End With
Set rs = Nothing
Set qdf = Nothing
Set db = Nothing