User Login Question

gary_getter1

Registered User.
Local time
Today, 15:46
Joined
Jan 20, 2006
Messages
17
I want to create a database need user login the system at first, i try to use a function to handle the checking, but it return "Type mismatch" & Runtime error "Operation is not allow when the object is closed", i am not sure my code is all right, can anyone help me to find out what the problem in my program?

Thx a lot!
 

Attachments

Are you trying to develop a login system, if so then don't bother. Firstly Access comes with workgroup protection although it can be difficult to set up at first. Any user written password system can always be bypassed or broken into. The last db I looked at had a user developed login system and even though the bypass key had been disabled I was able to invoke the debugger and get into the login form that way.
 
Last edited:
Dennisk said:
Are you trying to develop a login system, if so then don't bother. Firstly Access comes with workgroup protection although it can be difficult to set up at first. Any user written password system can always be bypassed or broken into. The last db I looked at had a user developed login system and even though the bypass key had been disabled I was able to invoke the debugger and get into the login form that way.

Thank for your opinion.
But i am not worry my user will bypass the user checking, because my user just need a data system to help them to search the data, and give the different button to select different from to view the needed data.

And now i find out the error happened on the connection to CurrentProject.

------------------------------------------------------------------------
Public Function GetRS(ByVal strQuery As String) As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Recordset
'On Error GoTo GetRS_Error

Set conn = CurrentProject.Connection
rs.Open Trim$(strQuery), conn, adOpenKeyset, adLockOptimistic
Set GetRS = rs

End Function
-------------------------------------------------------------------------

The debugger show me that conn = <Object variable or with block variable not set.> & CurrentProject.Connection = Provider= Microsoft.Jet.OLEDB.4.0;UserID=Admin;Data...

what should i do to correct it?
 
you need to open the connection

i.e.

dim conn as new ADODB.connection

conn.open currentProject.connection

or in the table open statement

rst.open mytable,Currentproject.Connection

using this method there is no need for the extra connection object
 
Last edited:
Thank for you help.

Yup, i forgot to set the connection on Dim statement, but there have another error when i solve out the connection, access alert me that a Run-time error as follow:
Run-time error '-2147217900(80040e14)': Syntax error in FROM clause.

and the debugger point out the error come from:
rs.Open Trim$(strQuery), conn, adOpenKeyset, adLockOptimistic

-------------------------------------------------------------------------
Public Function GetRS(ByVal strQuery As String) As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection

Set conn = CurrentProject.Connection
rs.Open Trim$(strQuery), conn, adOpenKeyset, adLockOptimistic
Set GetRS = rs

GetRS_Exit:
Set rs = Nothing
Set conn = Nothing
Exit Function

End Function
--------------------------------------------------------------------------
 
Hi,
That message is telling you that there is an error in strQuery.
Also There is probally no need to trim your SQL statement.
 

Users who are viewing this thread

Back
Top Bottom