Problems with DCount function 
Author Message
 Problems with DCount function

Try concatenating the value of y onto the string instead of including it
in the string.

Since y is numeric, this will be:
x = DCount("[Projekt]", "Anteckningar Fr?ga", "[Projekt] = " & y)

Quote:

> I have a problem getting the right structure of a DCount expression.

> The background is this:

> I have a control on a form "Projekt" that is named "Index". "Index" is the
> keyfield of a table also named "Projekt". When I push a button in the form
> I call via a macro a Visual Basic Module.

> I want to count the number of posts of a table "Anteckningar" where the
> field "Projekt" in "Anteckningar"  has the Value of "Index" (defined above).

> I use the DCount the following way.

>    With CodeContextObject
>            Dim x As Long
>            Dim y As Long
>            Dim strin As String
>            Dim stri As String
>            y = .Index
>            x = DCount("[Projekt]", "Anteckningar Fr?ga", "[Projekt] = y")
>            Beep
>            stri = Str(x)
>            strin = "Det finns " & stri
>            strin = strin & " anteckningar till detta projekt"
>            MsgBox strin, vbOKOnly, ""
>    End With

> DCount("[Projekt]", "Anteckningar Fr?ga", "[Projekt] = y")
>                                           ===============

> It seems to be the criteria that does not work.



Thu, 07 Jun 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DCOUNT divided by DCOUNT

2. Dcount function - need help with the criteria part!

3. Creating statistical function using DCount

4. Help Beginner with DCOUNT function

5. Dcount / Domain Agg Functions

6. DCount Function

7. Dcount / Domain Agg Functions

8. Help with DCOUNT overflow problem

9. Dcount VBA syntax problem

10. DCount problem

11. DCount - Problems

12. DCount and Date Problem

 

 
Powered by phpBB® Forum Software