Global Var in queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a global var "G_NAME"
I would like to use it in a query.

Is it posible?????????????????


Scott Burke
 
Yes, by using a function that return the variabe

Function Get_G_NAME ()
Get_G_NAME = G_NAME
End Function

Create the function in a module, and then you can use the function as
another field in the query or as a criteria

Select * From TableName Where FieldName = Get_G_NAME ()

Or
Select Get_G_NAME() As G_NAME, TableName.* From TableName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top