Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging Users Off Automatically 1

Status
Not open for further replies.

mpm32

Technical User
Feb 19, 2004
130
US
Hi,

I am trying to use the code found in faq181-2145. I have made the DB called TimeCtl. I am trying to log off users in a DB called Litigation Database.

I have established a reference to TimeCtl from Litigation Database. I have also linked the table tblLogOut to the TimeCtl DB.

When I open the Litigation Database I get this;

Compile Error: User-defined type not defined

Here is the code for the module and highlighted area;

Code:
[highlight]Public Function funShutDown(DatabaseName As String) As Boolean: funShutDown = False[/highlight]

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

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

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

Can anyone point me in the right direction on this?

Thanks in advance.
 
Check that you referenced the Microsoft DAO 3.x library and then:
Public Function funShutDown(DatabaseName As String) As Boolean
funShutDown = False
Dim db As DAO.Database
Dim rs As DAO.Recordset
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hey thanks. I did try that when the error came up and opened the VB window but it wouldn't save my changes. So when I was your post I tried going in and editing directly and it seems to be working. Just need to let the timers run to be sure.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top