• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

Is there a way to place the value of a variable as a criterion in the Query Design Window

I am trying to use the value of a variable as a criterion in the Query Design Window.

For example, I have the variable, ID_Flag, and I would like the ID column in the query to be equal to the value of ID_Flag as the critieria. However, Access won't allow me to do that. It keeps putting quotes around the variable name so it looks like this "ID_Flag". How do I get around this?

2 Solutions
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You could use a function to provide that:

Function MyValue() As Integer
  MyValue = ID_Flag
End Function

Then in your query, in Design view (in the Name row):

SomeField: MyValue()
geeta_m9Author Commented:
Both the solutions work. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now