dcount syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

what's wrong with the syntax of this:

=DCount("*","tblcontactdata","[date] Between #" & [txtboxstartdate] & "# And
#" & [txtboxenddate] & "#" &
IIf(IsNull(Forms!querybuilder!cboxupsource)=True,""," And [upsource]=" &
Chr(34) & Forms!formquerybuilder!cboxupsource & Chr(34)) &
IIf(IsNull(Forms!querybuilder!cboxdepartment)=True,""," And [department]=" &
Chr(34) & Forms!formquerybuilder!cboxdepartment & Chr(34)))

formquerybuilder is a form that creates the report that this dcount is a
part of. tblcontactdata is not the recordsource of that report. upsource,
department are both text. date is a date format. i have been playing with
this for a while and now i've got it to the point where i get a name error.
any thoughts? thanks.
 
Nothing jumps out as obviously wrong.

Are you getting an error message? If so, what is it? If you're not getting
an error message, what's happening?
 
i get a name error.
--
Greg D.


Douglas J. Steele said:
Nothing jumps out as obviously wrong.

Are you getting an error message? If so, what is it? If you're not getting
an error message, what's happening?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Greg said:
what's wrong with the syntax of this:

=DCount("*","tblcontactdata","[date] Between #" & [txtboxstartdate] & "#
And
#" & [txtboxenddate] & "#" &
IIf(IsNull(Forms!querybuilder!cboxupsource)=True,""," And [upsource]=" &
Chr(34) & Forms!formquerybuilder!cboxupsource & Chr(34)) &
IIf(IsNull(Forms!querybuilder!cboxdepartment)=True,""," And [department]="
&
Chr(34) & Forms!formquerybuilder!cboxdepartment & Chr(34)))

formquerybuilder is a form that creates the report that this dcount is a
part of. tblcontactdata is not the recordsource of that report.
upsource,
department are both text. date is a date format. i have been playing with
this for a while and now i've got it to the point where i get a name
error.
any thoughts? thanks.
 
Unfortunately, "name error" doesn't tell me anything. What's the exact text
of the error message? And when does it occur: when your code is running, or
when you try to compile the code? Does it matter whether or not there's
something selected in the comboboxes?

What are [txtboxstartdate] and [txtboxenddate]? If they're textboxes on your
form, you should refer them the same way you're referring to the comboboxes.

You're sure that upsource and department are the correct fields in
tblcontactdata, and that cboxupsource and cboxdepartment are the correct
name for the comboboxes on formquerybuilder?

BTW, you'd be better off renaming your field date in tblcontactdata.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Greg said:
i get a name error.
--
Greg D.


Douglas J. Steele said:
Nothing jumps out as obviously wrong.

Are you getting an error message? If so, what is it? If you're not getting
an error message, what's happening?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Greg said:
what's wrong with the syntax of this:

=DCount("*","tblcontactdata","[date] Between #" & [txtboxstartdate] & "#
And
#" & [txtboxenddate] & "#" &
IIf(IsNull(Forms!querybuilder!cboxupsource)=True,""," And [upsource]=" &
Chr(34) & Forms!formquerybuilder!cboxupsource & Chr(34)) &
IIf(IsNull(Forms!querybuilder!cboxdepartment)=True,""," And [department]="
&
Chr(34) & Forms!formquerybuilder!cboxdepartment & Chr(34)))

formquerybuilder is a form that creates the report that this dcount is a
part of. tblcontactdata is not the recordsource of that report.
upsource,
department are both text. date is a date format. i have been playing with
this for a while and now i've got it to the point where i get a name
error.
any thoughts? thanks.
 
Back
Top