473,218 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

Error 91: object variable or with block variable not set

"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 3598
hariharanmca
1,977 1GB
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 Expert 8TB
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 1GB
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 Expert 1GB
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
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.