[AccessD] Help with syntax please....OpenRecordset

Darren DICK d.dick at uws.edu.au
Tue Oct 12 21:31:41 CDT 2004


Hi Kath
Is this DAO?
If it is I think you have to declare the db bit somewhere

You have Set rs = db.OpenRecordset(StrQueryName, dbOpenDynaset)

But I cant see a dimension of the db paramter in you code (Is your code
snipped?)

If it's missing try db = currentdb or something like that
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti
Sent: Wednesday, 13 October 2004 11:46 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Help with syntax please....OpenRecordset

I am trying to use a saved query for my recordset source....but keep getting
an error 'Too few parameters - expected 1' on the line 'Set rs = '
After many hours, I can't fix it so would appreciate the help.....


Code:

----------------------------------------------------------------------------
----

Public Function EmailWebLetterRecipients() Dim strerrormsg, strsql,
StrQueryName As String Dim VarEmailto As Variant Dim intrecno,
IntWebLetterID As Integer Dim db As Database Dim rs As DAO.Recordset Set db
= CurrentDb


StrQueryName = "QryWebLetter_ReadRecipientsEmail"
  
Set rs = db.OpenRecordset(StrQueryName, dbOpenDynaset)     ' Open recordset
on saved query        ERROR HERE

With rs
    .MoveFirst
    .Edit

     VarEmailto = .Fields("LoginEmail")
    .Update
    .close
End With
'MsgBox ("Going to " & VarEmailto)

'Call Send_Email(VarEmailto, StrNamePDFFile)

Normal_exit:
    DoCmd.SetWarnings True
    Exit Function

Err_Handler:
    MsgBox "Error: [" & Err.Number & "]  " & IIf(Len(strerrormsg) > 0,
strerrormsg, Err.Description), vbCritical, "Error Message"
    Resume Normal_exit
End Function


----------------------------------------------------------------------------
----

Kath Pelletti
Software Design & Solutions Pty Ltd.
Ph: 9505-6714
Fax: 9505-6430
KP at SDSOnline.net
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list