RunTimeError

B

BRC

Hello All,
I am trying to write a method of shutting down the front
end of a Access 2003 database that is in use.
I was directed to a piece of code to accomplish this.

Public Function ShutDown(DatabaseName As String) As
Boolean: ShutDown = False

Dim db As Database
Dim rs As Recordset
Dim strSQL As String

DatabaseName = UCase(DatabaseName)
Dim myDate As Date: myDate = Now()
strSQL = "SELECT * FROM LOGOUT WHERE APPLICATIONNAME = '"
_
& DatabaseName & "' AND INACTIVE = 0 AND #" & myDate
& "# BETWEEN START AND FINISH"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount = 0 Then
GoTo OutShutDown
Else
ShutDown = True
End If

OutShutDown:
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Function

End Function

I get an error "Runtime Error 3061, too few parameters.
Expected 1."

The line the error appears in is : Set rs =
db.OpenRecordset(strSQL, dbOpenDynaset)

When I check the values in the line, strSQL seems to be
correct and dbOpenDynaset=2

Any ideas where to begin to look?

Thanks in advance,
BRC
 
G

Guest

Here is the strSQL line:
SELECT * FROM LOGOUT WHERE APPLICATIONNAME = 'MASTER
NAMEMATCH' AND INACTIVE = 0 AND #7/21/2004 11:18:23 AM#
BETWEEN START AND FINISH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top