Feb 28, 2004 #1 dcurtis Technical User Joined May 1, 2003 Messages 273 Location US Is it possible to pass a variable to DCount? Code: =DCount("[CountMe]", "data source", "[Critera] = [i][b]variable[/b][/i]")
Is it possible to pass a variable to DCount? Code: =DCount("[CountMe]", "data source", "[Critera] = [i][b]variable[/b][/i]")
Feb 28, 2004 #2 RoyVidar Instructor Joined Jun 16, 2000 Messages 6,606 Location NO This seems like a controlsource in Access. Then not directly, what you could do is create a public function to retreive the variable: [tt]Public Function GetMyvariable() as <yourdatatype> GetMyvariable = <name of variable> End Function[/tt] And then use the function name in the controlsrurce: [tt]=DCount("[CountMe]", "data source", "[Critera] =" & GetMyvariable())[/tt] - use appropriate qualifiers for the criteria (' for text, # for dates) Roy-Vidar Upvote 0 Downvote
This seems like a controlsource in Access. Then not directly, what you could do is create a public function to retreive the variable: [tt]Public Function GetMyvariable() as <yourdatatype> GetMyvariable = <name of variable> End Function[/tt] And then use the function name in the controlsrurce: [tt]=DCount("[CountMe]", "data source", "[Critera] =" & GetMyvariable())[/tt] - use appropriate qualifiers for the criteria (' for text, # for dates) Roy-Vidar