A family of Microsoft relational database management systems designed for ease of use.
Your syntax is slightly off. Try:
Shp = "Machine"
variable=DAvg("[TimeToClose]", "WorkRequests", "[Shop] ='" & Shp & "'")
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using Access 2007 to calculate an Average and Median value for a set of values. I have used the AVG in a query and DAvg in VBA and it works if I write the criteria. I want to replace the criteria with a string that I manipulate. I use a function called DMedian that works the same way.
The overall expression of variable =DAvg([Field], [Table], Criteria) translates to variable=DAvg("[TimeToClose]", "WorkRequests", [Shop] ='Machine'").
If I define a string in vba to use like Shp = "Machine" and try to run this I can get:
variable=DAvg("[TimeToClose]", "WorkRequests", [Shop] ='& Shp"')
I only get a Null value returned.
A few questions:
Any help would be appreciated!
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Your syntax is slightly off. Try:
Shp = "Machine"
variable=DAvg("[TimeToClose]", "WorkRequests", "[Shop] ='" & Shp & "'")