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
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