Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Public variable in Query 1

Status
Not open for further replies.

TimTDP

Technical User
Joined
Feb 15, 2004
Messages
373
Location
ZA
In Access 2000, I have created the variable:
Public intProductId as integer

how can I use this in a query?
I need to use it in the field of a query. I have an append query and I need to use the value of intProductId in the result.
I don't want to write an sql statement, because this will become quite difficult to manage
 





How is your variable assigned a value?

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
If I understand, you need to write a small function that returns the value of the public variable.

Code:
Public Function GetProductId() As Integer
    GetProductID = intProductId
End Function

You can then use GetProductID() in your query.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top