473,466 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error 91: object variable or with block variable not set

1 New Member
"Error 91: object variable or with block variable not set"

I am getting the above error while retrieving the index of selected row in listview.

Please help me out

Expand|Select|Wrap|Line Numbers
  1. Private Sub ListPersons_DblClick()
  2.  
  3. Dim row As Integer
  4. Dim item As ListItem
  5. Dim personid As Double
  6. Dim bsuccess As Boolean
  7. Dim msName As String
  8.  
  9.  
  10. 'Listpersons is the name of listview
  11. row = ListPersons.SelectedItem.index
  12. personid = ListPersons.ListItems(row)
  13.  
  14. End Sub
Or can anyone suggest any other method for retrieving the index of selecteditem in listview?
Aug 27 '07 #1
4 3613
hariharanmca
1,977 Top Contributor
Error 91 ...
Search for your query first and post new. Because here many post in same
topic. Anyhow change

you have to create 'New' instance for an object.
Expand|Select|Wrap|Line Numbers
  1. Dim item As ListItem
to
Expand|Select|Wrap|Line Numbers
  1. Dim item As New ListItem

Where are you using this item in this method?


Expand|Select|Wrap|Line Numbers
  1. personid = ListPersons.ListItems(row).Text
or
Expand|Select|Wrap|Line Numbers
  1. personid = ListPersons.ListItems(row).Subitem(<Column_Index>)
Aug 27 '07 #2
Killer42
8,435 Recognized Expert Expert
Could this simply indicate that no item is currently selected? (I'm not very familiar with the ListView control.)
Aug 27 '07 #3
hariharanmca
1,977 Top Contributor
Could this simply indicate that no item is currently selected? (I'm not very familiar with the ListView control.)
Yes, Thanks for the pick up.

if the Listview don't have any item and if you select the list view, it'll show this error.
Aug 27 '07 #4
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

to check if any Item in List is selected or not :

Expand|Select|Wrap|Line Numbers
  1. Dim TItem As ListItem
  2. If lvw.SelectedItem.text <> "" Then
  3.    Set TItem = lvw.SelectedItem
  4. End If
  5.  
Regards
Veena
Aug 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ike | last post by:
Anyone knows what cuases this under 6.0 ? -Ike
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
8
by: Lauren Quantrell | last post by:
I get the following error: "Object variable or Width block variable not set error" trying to run this in my Access2000 .ADP database: CurrentDb.Properties.Append...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
12
by: karen | last post by:
Hi all : this is going to be a long post. So i apologize in advance :) i am converting a java program in VB right now. I am a java programmer by trade. so i am no expert in this department. I...
4
by: majo | last post by:
Hi, I had posted this once earlier, but couldnt get my problem solved. When i run an asp.net application in windows 2003 server with IIS 6.0, it "SOMETIMES" gives me the below given error....
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
9
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
3
by: Newbie19 | last post by:
I'm trying to get a list of all subfolders in a folder on a share drive, but I keep on getting this error message: Object variable or With block variable not set. Description: An unhandled...
5
by: Al G | last post by:
Hi, I'm converting a bit of POP3 VB6 code to VB2005, and have run into this error with the following code. Can someone help me find out what I'm missing/doing wrong? 'holds the attachments...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.