Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dcount won't work

Status
Not open for further replies.

jammerdk

Technical User
Aug 16, 2001
51
DK
having the Dcount ...but can't get it to work

Me.txtTeamNo = Nz(DCount("[AttType]", "Attend", "([AttType]=1) And (TeamLookUp ='" & Me.lstGroup.Column(1) & "') "), 0)

txtTeam is a field on my form

and I'd like to count AttType that's equal to 1 and to make sure that a the Lookup "TeamLookUp" is equal to the lstbox "lstGroup"

Hope u guys can help
 
When you say it does not work, what do you mean? Error messages? Wrong result? From your description, it seems that you wish to perform two checks, but your code shows only one check.
 
getting the message "Cancelled the previous operation"

Well try to clear up the questions

LstGroup = Listbox "looking up value from Team tabel"..team1 team2 etc.

txtTeamNo = textbox "Count of 1's in the tabel Workers on a certain date and LstGroup being equal to the lookup 'TeamLookUp'"

 
I tested you Dcount statement on a mock-up and it works. You should check that you have the right names for everything and that column(1) of your list box (that is, the second column) has the proper data. You do not need Nz with Dcount, it will not return a Null but a zero.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top