[AccessD] DAO Query

Sad Der accessd666 at yahoo.com
Thu Sep 18 08:43:35 CDT 2003


Hi group,

I've got a function called GetStatus. It was created
by Bruce (from this list) and used to be in ADO. I
made changes so that it would now run in DAO.

Somehow the function doesn't work. At the line:
 Set rst = oDb.OpenRecordset(Name:=qryName)

I get the error:
3061 too few parameters Expected 1

However I call it like this:
    gstrSwitchStatus = GetStatus("qrySwitchStatus")

Any ideas?

TIA

SD

Public Function GetStatus(qryName As String) As String

 '
 ' Description / Purpose :-
 ' GetStatus executes a stored database query that
returns a status 
 ' The query MUST return only one row, and only one
Field "qryStatus".
 '
 ' Parameters:-
 ' PARAMETER TYPE COMMENTS
 ' qryName string The name of the select query to be
run
 '
' ' Version Dated Author Comment
' ' 1.0 28/06/2003 bruce Original.


 Dim strRtn As String
 Dim oDb As DAO.Database
 Dim rst As DAO.Recordset 'recordset returned by the
query

 On Error GoTo GetCount_ERR

 'lngRtn = -1
 strRtn = "FAILED"
 
 'Set conn = CurrentProject.Connection
 'Set rst = New Recordset
 Set oDb = CurrentDb()
 Set rst = oDb.OpenRecordset(Name:=qryName) ',
Type:=dbOpenSnapshot, Options:=dbOpenForwardOnly)

...
...
end function
 

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


More information about the AccessD mailing list