Bruce Bruen
bbruen at bigpond.com
Fri Sep 19 06:38:59 CDT 2003
Sander,
I cant remember what we were doing with this code but it looks like
qrySwitchStatus is expecting a parameter and I don't think looking at
the date of the code that I was using parameterised queries for anything
at that time.
Check the query - is it non-parameterised? Definitely only returning
one row?
Hth
Bruce
P.s. HI List! Just dropped in to clear the mailbox (>2000 unreads!) Oh
well - got to get back to the joys of reading McConnell (cant he just
say something ONCE!!!) and writing methodologies.....
-----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