Feb 28, 2004 #1 dcurtis Technical User May 1, 2003 273 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 Jun 16, 2000 6,606 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