|
-
Nov 24th, 2006, 04:45 AM
#1
Thread Starter
New Member
[RESOLVED] runtime error 91 object variable or With block variable not set
I've developed an application which has the following code for a command button. It is used to query an ADODC bound to a datagrid control. It runs fine on my machine but when run on another machine the data is not showing in the control and it comes up with the error message above when you click this button. I've copied all other files across with the 'exe' file. Does anybody know what the problem could be?
Private Sub Clear_login_Click()
Dim Clear_login_msg As Integer
Dim User_cleared_msg As Variant
Dim Conn1 As New ADODB.Connection
Dim Cmd1 As New ADODB.Command
Dim Rs1 As New ADODB.Recordset
Dim SQL_Connect As String
Dim luserID As Integer
Dim ldatabase As String
luserID = Adodc1.Recordset!userid
ldatabase = Adodc1.Recordset!DatabaseName
SQL_Connect = "Provider=SQLOLEDB.1;" & _
"Password=***;" & _
"Persist Security Info=True;" & _
"User ID=***;" & _
"Initial Catalog=TSSecurity;" & _
"Data Source=***;"
Clear_login_msg = MsgBox("Do you wish to clear the user?", vbYesNo + vbExclamation, "")
If Clear_login_msg = 6 Then
Conn1.ConnectionString = SQL_Connect
Conn1.Open
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "UPDATE TSSecurity.dbo.ts_usersec SET userloggedin = ' '" & _
"WHERE TSSecurity.dbo.ts_usersec.userid = " & luserID & _
"AND TSSecurity.dbo.ts_usersec.databasename = '" & ldatabase & "'"
Set Rs1 = Cmd1.Execute
Adodc1.Refresh
User_cleared_msg = MsgBox("The user has been cleared", vbOKOnly, "")
Conn1.Close
Conn1.ConnectionString = " "
Else
End If
-
Nov 24th, 2006, 09:06 AM
#2
Re: runtime error 91 object variable or With block variable not set
Yes, the problem is this: "I've copied all other files across with the 'exe' file."
That's not good enough I'm afraid, you need to create an installation package, using a tool like the Package & Deployment Wizard that comes with VB (and should be on your Start menu).
-
Nov 24th, 2006, 10:56 AM
#3
Thread Starter
New Member
Re: runtime error 91 object variable or With block variable not set
Thanks Si. I've just used the wizard and it is working a treat
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
|