Why is collection failing?

I'm creating a wrapper class for a collection object, mainly so I can
test whether a given records exists.  I'm baffled as to why I'm
getting "Invalid procedure or argument" in the exists function when I
try to extract the value, whether it actually exists or not.  I've
tried collection.item and collection(item), same result.  BTW, the
values are numbers that I convert to strings.

Option Compare Database
Option Explicit
'this class object extends the collection object to include an
'exists' boolean function

Private colStatus As VBA.Collection


Private Sub Class_Initialize()
    Set colStatus = New Collection
End Sub
Public Sub add(item)
  If exists(item) = False Then
    colStatus.add (CStr(item))
  End If
End Sub

Public Function count()
  count = colStatus.count
End Function

Public Sub remove(item)
  If exists(item) = True Then
    colStatus.RemoveItem (CStr(item))
  End If
End Sub

Function exists(item) As Boolean
  On Error GoTo does_not_exist
  Dim value As String
  Dim strItem
  strItem = CStr(item)
  value = colStatus.item(strItem)
  exists = True
  Exit Function
does_not_exist:
  exists = False
  On Error Resume Next
End Function

0
FP1
8/20/2007 5:03:08 PM
access.formscoding 7493 articles. 0 followers. Follow

0 Replies
1249 Views

Similar Articles

[PageSpeed] 58

Reply:

Similar Artilces:

CRM Import wizard fails to open outlook ~
I am testing CRM in a lab before implementation and I want to test importing many contacts, when I open the import contacts tool (tools>import>contct) in web crm interface I get a message after selectying outlook that states "Microsoft Outlook cannot be started, Verify that Outlook is installed on this computer. And I am stuck right there. Please help. Thanks. Seth Seth; CRM needs Outlook installed if you want to import from an Ooutlook PST file. The catch is that you cannot install OL on a CRM server, so you will need to set up a client workstation with OL installed and h...

The Operation Failed #5
I am using Outlook XP and my computer just starting throwing "The Operation Failed" error message when I click on Send/Receive. I have not changed anything and the problem just appeared out of nowhere. I have closed Outlook and reopened, but it made no difference. I am still able to receive and send mail automatically, but I can't do it when I click Send/Receive. I still don't know what / why it happened, but I shut down the computer and rebooted. Problem appears to have rectified itself. >-----Original Message----- >I am using Outlook XP and my computer just s...

DefaultCredentials fail
I am unable to run in an ASP.NET web application the sample code from the SDK to use the MSCRMServices. The sample's logon procedure is bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials; try { Microsoft.Crm.Platform.Proxy.CUserAuth _cUserAuth = bizUser.WhoAmI(); I get this error: "SOAP Server Application Faulted <detail><error><code>80040225</code><description>The specified user is either disabled or is not a member of any business unit.</description><file>d:\crm\build\3297 \src\platform\security\crmsecurity\secmain....

XmlSerializer Collection with Collections
Hello I got this working but it is not how I really want it, basically I have an xml file which has a root of <test> and can be filled with 3 different types of <question> elements with different attributes, all share a base set of 4, one of the question types can have children with <option> elements, this is how the xml looks after serialization.... If you notice there is an extra <SelectionList> around the <option>'s in the final <question>, how can I write my class so I don't have this extra <SelectionList> element....my class follows, you ...

Payroll Update Launch Failing
OK. So, I go to Maint<US Payroll Updates<Check for Tax Updates and the system gets angry. An error comes up saying: "This program can only be run through the Dynamics GP Application". It says this regardless of the client machine it is launched from (even does it from the server). It doesn't even get to the screen asking for manual or automatic. Thanks for any help. Did you ever get this resolved? We have the exact same issue.... "GPguyMike" wrote: > OK. So, I go to Maint<US Payroll Updates<Check for Tax Updates and the system > gets an...

Forwarding failed mail
Maybe I'm missing something, but forwarding failed mail is a nightmare. I can either forward the NDR or the e- mail, but not both. Exchange 5.5 would have the failed mail as an attachment when you forwarded it, so the correct recipient could see it was "failed mail"?? ...

about Collections
Hi! The ArrayList support the ICollection and IEnumerable. Below is three ways to iterate through a collection of an instance of an ArrayList object. I just find it's easier to iterate though a collection by using the for loop or the foreach so my question is when is it better or more appropriate to use the Enumerator. static void Main(string[] args) { ArrayList list = new ArrayList(); list.Add(1); list.Add("hej"); //Using the foor loop for (int i = 0; i < list.Count; i++) { Console.WriteLine(li...

LoadLibrary() fails in vista but works fine on XP
Hello, I'm surprised no one really encountered the exact problem that I've now. I've the VC++ code that works fine on XP but simply hangs up in Vista SP1. Here is the snippet. HINSTANCE hInst = NULL; // hInst = LoadLibrary("ThirdParty.dll"); I'm clueless. Thank you. Install third party dll on vista machine. :o) Then again maybe the third party dll is looking for a dll that is not installed on the vista machine. AliR. "KK" <pedagani@gmail.com> wrote in message news:0487c86a-57f5-480b-ad93-90a723868eab@n1g2000prb.googlegroups.com... > Hell...

Online Updates Failing
Does Microsoft plan to fix the failing online updates to Microsoft Money? Seems to be an issue they've been working on since December 8 with no resolution. I run the updates to my accounts, it processes for 20 minutes, then fails. Faulty product which Microsoft should either fix the major component or offer refunds. Yea really. The subscription is for "2 years of service" but for me was more like "2 days." "Help" wrote: > Does Microsoft plan to fix the failing online updates to Microsoft Money? > Seems to be an issue they've been working ...

Document failed to print...
I'm trying to print out some wedding invitations on card stock, I got one successful print, but the rest keep coming up with an error message reading "This document failed to print". I tried letting one of those through, and the document printed extremely dark. Any suggestions? Your printer driver is the culprit here. Go to the manufacturer's web site and look around for a newer driver. If one isn't available, uninstall and re-install your printer. It is advisable to completely remove your driver before installing/reinstalling. Bruce Sanderson's Windows Web ...

XML Serialization and custom collections
I am getting XML from a dataset that has been populated via a storedprocedure no schemas have been applied nor any relationships. But the correct table names have been given to match the table(s) equivalent business object(s). I have a custom collection that implements ICollection and IEnumerable. Here is the collection: Imports ERP.BusinessObjects Imports ERP.BusinessObjects.Helpdesk Imports ICTObjects.Collections Imports System.Xml.Serialization Namespace Collections <Serializable()> _ Public Class BusinessObjectCollection : Implements ICollection, IEnumerable ...

The operation failed #4
Sending of mail with attatchments does not work anymore. I try to send new mail, outlook opens word? where I can compose my mail message. It works fine if I do not attatch anything. But when I try to send it after I have added an attatchment an alert pops up. The great message in it is "The operation failed" and on the top left corner it says Word. I think I have not done anything out of the ordinary with neighter of the programs. Also everything else seems to be working. What could be the problem and howto fix it? Office: 2002 (outlook, word and all the rest) OS: W2K sp4...

XmlSerializer Collection with Collections #2
Hello I got this working but it is not how I really want it, basically I have an xml file which has a root of <test> and can be filled with 3 different types of <question> elements with different attributes, all share a base set of 4, one of the question types can have children with <option> elements, this is how the xml looks after serialization.... If you notice there is an extra <SelectionList> around the <option>'s in the final <question>, how can I write my class so I don't have this extra <SelectionList> element....my class follows, you ...

Opening existing email activities failed
Hello, When I try to open an existing email activities inside a contact, I have an error message. The only thing I can view is : An+unhandled+exception+occured+during+the+execution+of+the I have MSCRM 3.0 Update Rollup 1 running on a Windows Server 2003 SP1 Can you please provide more detail about the error? You might need to enable the DEV error to get more detail. Darren Liu, CRM MVP Crowe http://www.crowecrm.com On Oct 19, 10:11 am, Sylvain <Sylv...@discussions.microsoft.com> wrote: > Hello, > > When I try to open an existing email activities inside a contact, I hav...

Problems I got from collecting data feature of Access 2007
I at first think the collect data through Outlook in Access 2007 is very interesting. But I tried it in multiple platforms, seems like it doesn't always work fine. I got the following problems: 1. There is always having delay to receive the email from the sender. Some of the email addresses haven't received any email from the sender so far. 2. The e-mail client has to support HTML. The SENDMAIL developed by Google which my school is using doesn't support this, I guess. When I try to reply the receiving email, the content body is blank; the form cannot be displayed. 3. Even ...

Outlook Lead Import Fails
When I attempt to import leads using outlook I get a blank window. This is after I click import from the CRM menu. Fyi, import works in the Web CRM interface. Any suggestions. ...

Collection Letters
I have recent modified our collection letters to suit our business needs. I am fairly new to GP and I need assistance in change the date format to Australian setup. Your assistance is appreciated. ...

System.Diagnostics.Process.Start fails on windows server 2003
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine. anything to do different for windows server 2003? some special permission for the process that executes another executable with System.Diagnostics.Process.Start ?? here is the code: System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); // could be any executable file even notepad.exe process.WaitForExit(); if(process.ExitCode != 0) { throw n...

Import of accounts fails
Got a bit of a strange situation. I am trying to import new account. This fails with the error: "Data in row did not match the import type", error code 0x8004032d. I checked the Microsoft site checked the Microsoft site http://www.microsoft.com/dynamics/crm/using/troubleshooting/tsbulkimport.mspx .. Here they say it is realted to importing look up fields. Situation is, that I am not importing lookup fields. I have two environments: a live environment (without the latest modifcations) and a test environment (with modifcations). The new accounts that need to be imported, have...

Data Collection Question
Greetings, everyone... Please help me. I have designed a slef paced presentation to instruct employees on something. I want to include one ot two slides at the end which will accept typed-in answers to questions to test the employees retention and knowledge. I want the presentation to then dump the answers into some sort of file for later review by the training staff. Any ideas? Thanks in advance... Russ Wrong group news://msnews.microsoft.com/microsoft.public.powerpoint -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.msauer.mvps.org/ news://msnews.microsoft.com "...

Updates fail
Windows Vista Home Premium Dell Inspiron 1525 Removed a number of viruses, Trojans and other malware from the machine. It now fails on any attempt to do updates. It does the download, makes a restore point, says it's starting the installation, then fails. Failure codes include (but are not limited to) 80070490, 80246007, 80070016 and C000013A. The first one is the one that occurs most often. In addition, updates which the update history shows as having been installed successfully are now being shown as needing to be installed again. I've tried several of the KB ar...

Allforms Collection in another db (A2007)
I want to walk through the Allforms collection (and the querydefs, etc collections) from one db("object") to another("source") (both A2007). I want to use the last modified date from the source db to populate a listbox on the object db. I'll then ask the user to select the forms (queries, etc.) he wants to transfer to the object db. Similar to the Access Wizard, except the Access Import wizard doesn't tell me anything about the forms, queries, etc. I'm transferring. Anyway, how do I refer to the forms collection on another database using vba? ...

Add Notes to Credit Memos for Collections Management
Would like ability to Add Notes to Credit Memos for Collections Management. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=9576abfa-13b7-41b9-b471-f52334ff05db&dg=micro...

Operation Failed
I have Outlook 2003 and when I attempt to export data (file-import and export, export, export to a pst) to a pst file I get the messge: "The Operation failed" " An Object Cannot be found" Also, if I attempt to open a back-up pst file Outlook crashes. Any ideas? Jack Do you have outlook as part of an office suite? Did you try help, detect and repair? -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net...

Data collecting from different sheets
Hi! I have a workbook where I collect data to "raw data sheets". In theese sheets the average of eath data category is calculated. What I need is a macro that i can run in each new sheet so that theese averages are filled into a presentation sheet. To make things more complicated there will be different amounts of data (rows) in eath sheet. The setup I need to work with is this: Column A: States the type of data (only in the row where the average data is, otherwise blank) Columns C,E,G,I,K,M,O,P: The data I wish to copy. (But only in the average data rows, determ...