Hi Hans - hope you're social distance experience is going ok....
- hey last week or maybe two I check in and the web site said it was transferring to a new host....
and the thought occurred to me that I would hate for you to retire / close the site without saying goodbye so you've
got to promise to send out an email to all of your fans...
anyhoo the question of the moment:
have a query object with criteria that calls a form/control
can that query object criteria be a module variable? how would one dim/define the variable so that the query object can use it?
thanks...
query object and module variable
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: query object and module variable
I'm fine, and I hope that you are well too.
You could use a variable and a function to get its value.
If the criteria is for a Number (Long Integer) field, declare a variable of type Long.
If it is for a text field, declare a variable of type String.
If it is for a date/time field, declare a variable of type Date.
If it is for a yes/no field, declare a variable of type Boolean.
For example, at the top of the module:
Also create a function:
In the Criteria row of the relevant column of the query, enter
GetMyValue()
The query will now use the value of the variable MyValue.
You could use a variable and a function to get its value.
If the criteria is for a Number (Long Integer) field, declare a variable of type Long.
If it is for a text field, declare a variable of type String.
If it is for a date/time field, declare a variable of type Date.
If it is for a yes/no field, declare a variable of type Boolean.
For example, at the top of the module:
Code: Select all
Public MyValue As Long
Code: Select all
Function GetMyValue() As Long
GetMyValue = MyValue
End Function
GetMyValue()
The query will now use the value of the variable MyValue.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 308
- Joined: 24 Dec 2015, 16:41
Re: query object and module variable
thanks am going to set up a test of this....