Re: DCount function
- From: "tina" <nospam@xxxxxxxxxxx>
- Date: Sun, 29 May 2005 00:47:05 GMT
try
= DCount(1, "TableA", "[date] = #" & Date() & "# And
[Field1A] = '" & txtField1B & "' And [Field2A] = '" & txtField2B & "'")
the above expression assumes that Field1B and Field2B are both Text data
type. if either (or both) is a number, remove the *single* quotes that
surround each non-text value.
btw, the word "date" is a Reserved word in Access; you should not use it as
the name of a field in a table, or as the name of anything else in your
database. suggest you change that field's name in TableA to something else.
hth
<SheldonMopes@xxxxxxxxxx> wrote in message
news:42990ba2.213218@xxxxxxxxxxxxxx
> I'm having difficulty with the DCount function, not getting the
> results that I want.
>
>
> Field1A and Field2A are fields in TableA matching Field1B and Field2B
> in TableB
>
> Using a calculated control in a subform bound to TableB, Field1B and
> Field2B are on the form. (Control names are txtField1B and txtField2B)
>
>
> = DCount("ID", "TableA", "([TableA].[date]=date() AND
> [TableA].[Field2A]=[TableB].[Field1B] AND
> [TableA].[Field2A]=[TableB].[Field2B])")
>
> I have tried this also using the reference to the controls on the form
> as well, but still no good:
>
> = DCount("ID", "TableA", "[TableA].[date]=date() AND
> [TableA].[Field1A]=forms!frmSubform1!txtField1B AND
> [TableA].[Field2A]=forms!frmSubform1!txtField2B")
>
> What am I doing wrong ? Thanks in advance for any help.
>
>
.
- References:
- DCount function
- From: SheldonMopes
- DCount function
- Prev by Date: DCount function
- Next by Date: Re: Advanced Filter w/date field
- Previous by thread: DCount function
- Index(es):