ACTEBS
actebs at actebs.com.au
Fri Sep 19 09:46:32 CDT 2003
Sad,
Off the top of my head Change:
Set rst = oDb.OpenRecordset(Name:=qryName)
to:
Set rst = oDb.OpenRecordset("qryName",dbopendynaset)
HTH
Regards
Vlad
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Sad Der
Sent: Thursday, 18 September 2003 11:44 PM
To: Acces User Group
Subject: [AccessD] DAO Query
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
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com