Compile Error

I am wanting my program to look at a name in the combo box and determine if 
the  name is also a participant.
 
I am receiving a compile error : variant not defined.  
when it does this it highlights Particvolu of  "particvolu  =" Participant"


Dim ParticipantName As Integer

ParticpantName = DCount("ID", "Combobox query", "volID", "Particvolu" = " & 
cboName & " And Particvolu = "Participant")

0
Utf
5/20/2010 6:20:05 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

5 Replies
742 Views

Similar Articles

[PageSpeed] 32


"nancy" wrote:

> I am wanting my program to look at a name in the combo box and determine if 
> the  name is also a participant.
>  
> I am receiving a compile error :wrong number of arguments or invalid property assignment.
 
 
> Dim ParticipantName As Integer
> 
>ParticpantName = DCount("ID", "Combobox query", "volID", "Particvolu", "Relationship" = " & cboName & " And [particvolu] = "Participant")
> 
0
Utf
5/20/2010 6:57:01 PM
On Thu, 20 May 2010 11:20:05 -0700, nancy <nancy@discussions.microsoft.com>
wrote:

>I am wanting my program to look at a name in the combo box and determine if 
>the  name is also a participant.
> 
>I am receiving a compile error : variant not defined.  
>when it does this it highlights Particvolu of  "particvolu  =" Participant"
>
>
>Dim ParticipantName As Integer
>
>ParticpantName = DCount("ID", "Combobox query", "volID", "Particvolu" = " & 
>cboName & " And Particvolu = "Participant")

Your quotes are messed up. The third argument to DCount() needs to be a
String, which can be constructed by tacking together string constants
delimited by ", such as "[Particvolu] =", and variable values such as the
names of controls on the form.

This is made more complicated by the fact that a Text criterion must be
delimited by quotemarks, and putting quotemarks inside a string constant
delimited by quotemarks can be confusing (it's possible, just confusing!)

The other thing that's confusing about your example is that you're apparently
asking for records where the field named Particvolu is - at one and the same
time - equal to the value found in the combo box, and ALSO equal to the text
string "Participant". That's probably never going to happen! What is in the
field [Particvolu]? Where is the information that a person is a Participant to
be found in your table? What field contains the participant's name? What is
the value of the combo box: a name (which might not be unique) or a numeric
ParticipantID?
-- 

             John W. Vinson [MVP]
0
John
5/20/2010 7:51:30 PM
Maybe I am going about this the wrong way. ..

The names from the combo box come from a query called “Combobox query”, 
where it is joining two tables.   The combobox name on the form is “cboName”

The SQL from the Combobox Query is:  SELECT table1.volID, volName & " " & 
VolLastName AS Expr1, Address1.Inactive, Address1.IDFROM Address1 RIGHT JOIN 
table1 ON Address1.ID = table1.ADDRESS1_ID  WHERE (((Address1.Inactive)=No))  
  ORDER BY table1.VolName;

I have also used another query that selects the name if it was a participant 
and active: 
The SQL for it is  “SELECT table1.volID, volName & " " & VolLastName AS 
Expr1, Address1.Inactive, Address1.ID, Address1.Particvolu  FROM Address1 
RIGHT JOIN table1 ON Address1.ID=table1.ADDRESS1_ID  WHERE 
(((Address1.Inactive)=No) AND ((Address1.Particvolu)="Participant"))  ORDER 
BY table1.VolName;”

I would like to use the combo box that comes from “Combobox query”, because 
I am using it for another macro on the same form.    

To answer your question  What is in the  field [Particvolu] It is a drop 
down box that contains either participant or volunteer.

Maybe I could do something like.
If (cboName) <> 0 and [address1.particvolu] = “participant” then…
Suggestions?
0
Utf
5/20/2010 10:11:01 PM
On Thu, 20 May 2010 15:11:01 -0700, nancy <nancy@discussions.microsoft.com>
wrote:

>Maybe I am going about this the wrong way. ..
>
>The names from the combo box come from a query called �Combobox query�, 
>where it is joining two tables.   The combobox name on the form is �cboName�
>
>The SQL from the Combobox Query is:  SELECT table1.volID, volName & " " & 
>VolLastName AS Expr1, Address1.Inactive, Address1.IDFROM Address1 RIGHT JOIN 
>table1 ON Address1.ID = table1.ADDRESS1_ID  WHERE (((Address1.Inactive)=No))  
>  ORDER BY table1.VolName;
>
>I have also used another query that selects the name if it was a participant 
>and active: 
>The SQL for it is  �SELECT table1.volID, volName & " " & VolLastName AS 
>Expr1, Address1.Inactive, Address1.ID, Address1.Particvolu  FROM Address1 
>RIGHT JOIN table1 ON Address1.ID=table1.ADDRESS1_ID  WHERE 
>(((Address1.Inactive)=No) AND ((Address1.Particvolu)="Participant"))  ORDER 
>BY table1.VolName;�
>
>I would like to use the combo box that comes from �Combobox query�, because 
>I am using it for another macro on the same form.    
>
>To answer your question  What is in the  field [Particvolu] It is a drop 
>down box that contains either participant or volunteer.
>
>Maybe I could do something like.
>If (cboName) <> 0 and [address1.particvolu] = �participant� then�
>Suggestions?

A field *is not a dropdown box*.

A field is *DATA* - text, or a number, or a date.

A dropdown box is not data; it's a *tool for displaying data*.

I'm still not at all clear what you're trying to do. What does it mean that
"cboName <> 0"? Is the user selecting a name from the combo box? If so does it
matter which name they select? If there are 8124 records in Address1 and you
ask if [address1].[particvolu] is equal to "Participant", and it is for 3489
of them and is not for the rest, what result do you want?
-- 

             John W. Vinson [MVP]
0
John
5/20/2010 10:44:27 PM
In addition to the things John has explained, you state

"I am receiving a compile error :wrong number of arguments or invalid
property assignment."

That's because you have 4 arguments in your DCount() function and it only
takes 3 arguments!

ParticpantName = DCount("ID", "Combobox query", "volID", "Particvolu",
"Relationship" = " & cboName & " And [particvolu] = "Participant")

What is volID supposed to be?

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

0
Linq
5/21/2010 3:06:29 AM
Reply:

Similar Artilces:

Password error when e-mailing a spreadsheet.
I receive this error when attempting to e-mail a spreadsheet (by clicking 'Send this sheet' in Excel): "A sheet in the workbook you are trying to save is password protected. Password protected sheets cannot be saved in the HTML format. To save this file in HTML, you must first remove the password." Is there a workaround or solution for this error that will allow me to e-mail a password protected spreadsheet from within Excel? Thank you. Send it as an attachment, but send it as a *.xls file--a real workbook???? swellett wrote: > > I receive this error when at...

Error Message 04-25-07
Hi all, I am using a module to lookup records in my database. The module allows an unbound box to look up records by matching the record to the text typed in the box. I am using cboFindAsUType and Access 2000. The problem is that the module is used in 2 different forms and brings up this error in only 1 form. Error accessing fill. Network connection may have been lost. The entire database and all records are on my computer and until yesterday worked fine. Any help would be greatly appreciated. Thank you, Byron This sounds like a really nasty bug in the early release of Access 2000. ...

Error message with Outlook 2007
I am running into problems with some of my users with previews. The error message I am getting is This file cannot be previewed because of an error with the previewer. To open the file double-click it. I found out the problem. Uninstall google desktop.. Just as an FYI "Joe" <josephadeluca@gmail.com> wrote in message news:40EFABD0-33C0-449A-A48E-75CD67B8C648@microsoft.com... > I am running into problems with some of my users with previews. The error > message I am getting is > This file cannot be previewed because of an error with the previewer. To > ope...

Upgrading to newest money money updates... errors..
I've been using Money 2005 for a month or so... I decided to switch which computer I use it at at home. Just yesterday I think was the last update that asked me to back up my file. Now, I've installed the program on a new computer we got and everytime it tries to download the latest money update it crashes when it goes to install it. It says I dont have access to the file or that it may be 'read only' or not enough disk space (needs 100 megs). I can use the file perfect on the orginal computer, it's not marked read only, and there's over 40GB of space available....

Keep getting this Error ID: 0x800CCC0F
Any suggestions on how to fix this error? Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Subject 'Fw: ' Server: 'smtp.gmail.com' Windows Live Mail Error ID: 0x800CCC0F Protocol: SMTP Port: 25 Secure(SSL): Yes "Poodlenation" <Poodlenation@discussions.microsoft.com> wrote in message news:E5FED1D7-835F-4BFE-B7E7-D81D05696967@microsoft.com... > Any suggestions on how to fix this error? > > Your server has unexpectedly terminat...

Windows Server 2008 Installation Error
Hi , I am trying to install WinServer 2008 checked build x86 in my computer but I get following error when I put the key: Windows Server 2008 Installation Error: Windows installation has encountered an error and needs to be restarted. i restart the installation but the problem happens again. any fix for this? Thanks, Are you booting from the installation media? -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "dfrg" wrote: &g...

Error starting
Hi, when i try to connect to the CRM i get the following error: errorhandler.aspx?errNum=0x80040E4D ...

ERROR 1053 when strating CRM 1.2 on Windows 2003
When strating the MSCRM Security Service I get the following error. ERROR 1053: THe service did not respond to the strat or control request in a timly fashion. We have just installed CRM prior to migrating it from a 2000 server. Any sygestions on what could be causing this ?? Thanks ...

Saving error on network
When I open a word or excel file on network (mapping drive), when I tried to Save As a new file (On network drive as well), the errors occur. Any one know what the error means? +-------------------------------------------------------------------+ |Filename: 1.JPG | |Download: http://www.excelforum.com/attachment.php?postid=4148 | +-------------------------------------------------------------------+ -- ryanlcs ------------------------------------------------------------------------ ryanlcs's Profile: http://www.excelforum.com/memb...

Error that prevents Copy Worksheet to another Tab
When I try to copy a worksheet as another tab in the same file or to another excel file, I get the error listed below. I can move the worksheet, I just can not copy it. Microsoft Office Excel cannot access the file ‘C:\DOCUME~1\JEFFRE~1.JEF|LOCALS~1\TEMP”. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook. Bullet point one has not meaning since at this point I am not trying to open a file. The program has not problem opening fi...

Run Time error When Outlook XP starts in WXP
I just upgraded my Dell PII 400 from W2000 SP4 to WXP SP1. I was having a lot of problems with Outlook XP (all updates applied) crashing multiple times while in use, which was 1 reason for the upgrade. Now when I start Outlook, most times I get a message box entitled: 'Microsoft Visual C++ Runtime Library' with the text: 'Runtime Error! Program: C:\PROGRA~1\MICROS~2\Office10\OUTLOOK.EXE abnormal program termination.' When I click OK, Outlook closes. The next time, it starts OK, but has to scan the Personal folder for errors. Fixes? Britt Dickson -- "In an era o...

can not accses my email i get Error Number: 0x800CCC32
Unable to poll for new messages on your HTTP server. Account: 'Hotmail', Server: 'http://services.msn.com/svcs /hotmail/httpmail.asp', Protocol: HTTPMail, Server Response: 'Authorization Required', Port: 0, Secure(SSL): No, Error Number: 0x800CCC32 abe <anonymous@discussions.microsoft.com> wrote: > Unable to poll for new messages on your HTTP server. > Account: 'Hotmail', Server: 'http://services.msn.com/svcs > /hotmail/httpmail.asp', Protocol: HTTPMail, Server > Response: 'Authorization Required', Port: 0, Secure(SSL): ...

content conversion errors in Exch 2003
Hello, I am getting the following errors in Exch 2003 when receiving emails from a client who is running Boldon James Enterprise Mail 3 (3.6.1 update 2). I have the patch MS04-002. Any ideas what is going on and how to resolve it? Thanks Jon Global domain identifier (Country, ADMD, PRMD) in first Trace Information of message C=gb;A= ;P=hmg+jon-dev;L=itcuser:267750:20040513134619 does not match MTSID value. [MTA XFER-IN 13 40] (12) Object 0600003E received from entity /DC=UK/DC=MIL/DC=TS/DC=DIS/CN=CONFIGURATION/CN=SERVICES/CN=MICROSOFT EXCHANGE/CN=DISEXCHANGE/CN=ADMINISTRATIVE GROUPS/CN=F...

Error message in Outlook 2002
I receive the following error message when opening Outlook 2002 connected to an Exchange Server (2000). This has only begun after trying (unsuccessfully) to sync only my calendar with my new Palm. "Could not install the custom actions. A required action was not successful due to an unspecified error." I get this error twice before Outlook will open. Thanks fo rany help! ...

syntax error (at stored proc)?
Hi, I am not sure what is the issue. I got following error. "Incorrect syntax near '@Param'." Bottom is the stored procedure. --------------------------------------------------------- CREATE PROC [dbo].[spCreateUser] @Param nvarchar(50) AS BEGIN CREATE USER @Param FOR LOGIN @Param END --------------------------------------------------------- I would appreciate if you let me know. Thanks. You cannot use parameters/variables in the CREATE USER statement. To accomplish that you would need to use dynamic SQL. -- Plamen Ratchev http://www.SQLStudio.co...

Exchange 2003/Outlook2003 Receive Error
Has any ever seen, and fixed the following error when Outlook 2003 is trying to receive data from Exchange 2003. "Task 'Microsoft Exchange Server' reported error (0x8004010F) : 'The operation failed. An object could not be found.'" I'm not sure exactly what broke it, but this is on a test rig. Uninstalled deleted directories and reinstall Exchange. Client side, happens to three out or three test workstations. Tried removing and recreating profiles. Just out of things to try. Thanks Larry Warnat Turn off cached mode and see if it goes away. If so it i...

error changing data type
I have a 500-MB access 2002 database with several numeric fields of type Double. I'm trying to convert the double fields to decimal fields. I get the following error when saving the table after applying the field change: Microsoft Access can't change the data type. There isn't enough disk space or memory. I have 9 GB free on my hard drive, and I have 512 MB of RAM. What do I need to do to convert these fields? Thanks. I forgot to mention that I'm running Access 2002 sp2. Copy the table without carrying the data across, creating an empty table. Make the changes in...

FRx Printer Error
We're trying to change a printer in FRX; but get the error: Error: 0. Occured in: PrintCommonDialog() I did find an earlier thread on this; but the solution did not work.. This is for FRx 6.7 SP10 and GP10 All GP users are Terminal Server Users. Any ideas? Willwonka, I suggest you initially try resolving this issue by visiting KB article 931722 and see which cause may apply to your situation. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com "willwonka" wrote: > We're trying to change a print...

Error on Navigation Bar 05-07-04
On one of my client PCs the navigation bar does not work correctly. After two or three clicks on the bar I got the following error; yet the GoTo in the menu bar is working fine. Line: 69 Char: 4 Error: Permission denied Code: 0 URL: http://w-mscrm/bar_bottom.aspx?startPage=Home Please help!.. I am receiving this error too, any help would be appreciated! ...

Error Code 0x80246007
i tryed downloading windows updates and it fails and sayes i have Error Code:0x80246007 is thair a way around this? i have a compaq Evo N1000v with windows xp pro Are you try to install Windows XP Service Pack 3 from Windows Update ? -=- "volcompunk" wrote: > i tryed downloading windows updates and it fails and sayes i have Error > Code:0x80246007 is thair a way around this? > > i have a compaq Evo N1000v with windows xp pro 0x80246007 SUS_E_DM_NOTDOWNLOADED A BITS transfer error occurred, but the exact error could not be retrieved. Are you runn...

Viewing error: can only see in Full Screen
Hi all, TIA for the help. I've had 2 users in the last month or so say that when they open their sheet, it only displays a grey screen. Once i flip it to View > Full Screen, the sheet comes up. Any solutions? Thanks, Kevin M ...

Error opening Word 2007
When I open Word I get the following error: " The language DLL 'VBE6INT.DLL' could not be found Can anyone help me with this problem Open the Windows Control Panel and go to the Add/Remove Programs dialog (if you have Windows Vista or Windows 7, it's called Programs and Features). Click the Office 2007 item and choose "Change"; when the installer window opens, choose the Repair option. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may...

SMTP Protocol Error Ocurred
I have an email sitting in a queue that is supposed to go to a distribution group within the domain. It has been in the Retry state for two days now. The listing in the queue is: SMTP Outbound - IIS2 (SMTP Connector). I have not configured a connector for IIS2 so I don't know why Exchange is trying to route through it. This occurs regardless if the email is sent from w/in the domain or external to it. Running Exchange 2003 on a Win2000 server w/SP4. ...

Receive Windows Installer error 1605 when loading
Hired a tech for $$$ to transfer old templates from my old Windows ME to my new notebook running XP. When the templates would not load properly the technician deleted them. Now I receive an Windows Installer Error preventing me from loading Publisher 2003 at all. Could you give me some idea what file might have been deleted in error that would cause such a problem and how I can retrieve a replacement. Is there a list of files where I can compare what is missing from the application? The package came bundled with the notebook and I don't want to have to do a system restore lo...

Compiled Excel macros
Hi, I think about selling my own Excel wordbook, that contains some macros. But I don't want anyone to see these macros. I tried to set password on VBA project, but it's insecure. There are programs to crack this password. I know, that Access has *.mde files, which contain macros in a compiled form. Does Excel have a similar functionality? Are there any other hints to prevent users from seeing the macros? Thanks in advance! T. You can create COM addins or DLLs that are written in VB and can be compiled, but not in VBA. Problem here of course is that you need a full version o...