|
-
Mar 22nd, 2002, 12:31 AM
#1
Thread Starter
New Member
ADO please help
Hello In a MDI application, I have a login form that is not a child. there is an ado data control that is linked to a user table that allows users to be added and removed from the database application. In the click event for cmdOK after the user enters their user name and password, I wrote the following code:
adoUser.recordset.find "Rights ='" & txtUserName.Text & "'"
The problem is Whenever the user clicks ok error message 91 comes up saying, "object variable or with block not set". What could possibly be the problem
Thanks in advance for any help
-
Mar 22nd, 2002, 12:35 AM
#2
-
Mar 22nd, 2002, 01:33 AM
#3
Thread Starter
New Member
Here is the code: I declared rsUser as adodb.recordset in the general declarations area.
rsUser.Open
rsUser.MoveFirst
rsUser.Find "Rights ='" & txtUserName.Text & "'"
If rsUser.EOF = True Then
MsgBox "Sorry This username does not exist", vbInformation _
+ vbOKOnly, "Invalid Username"
ElseIf rsUser("Password") = txtPassWord Then
Unload frmLogin
Else
MsgBox "Sorry, incorrect Password", vbInformation _
+ vbOKOnly, "Password Error"
End If
I hope this helps to make my problem clear.
-
Mar 22nd, 2002, 01:42 AM
#4
public rsuser as adodb.recordset
Code:
set rsuser = new adodb.recordset
'Did you include this too?
rsUser.Open
'HEY!!!! ***????
rsUser.MoveFirst
rsUser.Find "Rights ='" & txtUserName.Text & "'"
If rsUser.EOF = True Then
MsgBox "Sorry This username does not exist", vbInformation _
+ vbOKOnly, "Invalid Username"
ElseIf rsUser("Password") = txtPassWord Then
Unload frmLogin
Else
MsgBox "Sorry, incorrect Password", vbInformation _
+ vbOKOnly, "Password Error"
End If
I think having an SQL query string would be very helpful
for example
rsuser.open "SELECT * from members", objconn, adopenstatic, adlockreadonly
Objconn is your adodb.connection. Please tell me you have one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|