From: Marta Rosa on
I know that this worked for SGangs, but does not work for me.

What is wrong with this statement?

=DLookup("count(id)", "[tab-alunos-des]", "escalao = Nz([escalao],1)")

I am trying to use this on a source control for a text field in a form
connected to other table (not "tab-alunos-des").

The error message says that something is missing...

I can't make it to work :(

Any help will be welcomed, thanks in advance.


"Allen Browne" escreveu:

> Use a DLookup() expression in the Control Source of your text box, e.g.:
> =DLookup("SomeField", "Table2")
>
> If you need to use the Criteria as well, this may help you figure it out:
> Getting a value from a table: DLookup()
> at:
> http://allenbrowne.com/casu-07.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "SGangs" <SGangs(a)discussions.microsoft.com> wrote in message
> news:097AFFC2-0F39-4483-980C-0F7DF262D89C(a)microsoft.com...
> >I would like to display a field from a selected record from an unrelated
> > table - table2 (not the source) in a form as a header. Since the control
> > source is table1 which is in no way related to table2, i'm sort of
> > confused as to how can i use it. Please help.
>
From: Paul Shapiro on
The DCount function returns the number of records in a specified set of
records (or domain).

The syntax for the DCount function is:
DCount ( expression, domain, [criteria] )
expression is the field that you use to count the number of records.
domain is the set of records. This can be a table or a query name.
criteria is optional. It is the WHERE clause to apply to the domain.

"Marta Rosa" <MartaRosa(a)discussions.microsoft.com> wrote in message
news:B3D2F68E-A1E8-437D-84E2-44CFB773848B(a)microsoft.com...
> I know that this worked for SGangs, but does not work for me.
>
> What is wrong with this statement?
>
> =DLookup("count(id)", "[tab-alunos-des]", "escalao = Nz([escalao],1)")
>
> I am trying to use this on a source control for a text field in a form
> connected to other table (not "tab-alunos-des").
>
> The error message says that something is missing...
>
> I can't make it to work :(
>
> Any help will be welcomed, thanks in advance.
>
>
> "Allen Browne" escreveu:
>
>> Use a DLookup() expression in the Control Source of your text box, e.g.:
>> =DLookup("SomeField", "Table2")
>>
>> If you need to use the Criteria as well, this may help you figure it out:
>> Getting a value from a table: DLookup()
>> at:
>> http://allenbrowne.com/casu-07.html
>>
>> --
>> Allen Browne - Microsoft MVP. Perth, Western Australia
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "SGangs" <SGangs(a)discussions.microsoft.com> wrote in message
>> news:097AFFC2-0F39-4483-980C-0F7DF262D89C(a)microsoft.com...
>> >I would like to display a field from a selected record from an unrelated
>> > table - table2 (not the source) in a form as a header. Since the
>> > control
>> > source is table1 which is in no way related to table2, i'm sort of
>> > confused as to how can i use it. Please help.


From: Stuart McCall on
"Marta Rosa" <MartaRosa(a)discussions.microsoft.com> wrote in message
news:B3D2F68E-A1E8-437D-84E2-44CFB773848B(a)microsoft.com...
>I know that this worked for SGangs, but does not work for me.
>
> What is wrong with this statement?
>
> =DLookup("count(id)", "[tab-alunos-des]", "escalao = Nz([escalao],1)")
<snip>

The Nz expression must be outside the quotes:

=DLookup("count(id)", "[tab-alunos-des]", "escalao = " & Nz([escalao],1))