|
Joe,
You wish to run a query with prameter input, with the
feature that this parameter input should have the current year as its
default value.
The desired objective can be achieved by invoking the
input box via user defined function. Sample query as well as the user defined
function (Fn_SalesYear()) used there-in, are given below.
T_Sales is the source table while SDate is date type field.
Note - Similar results could be achieved by enclosing
the parameter prompt within an IIf() statement. However, in such a case, the
default value that is going to be actually used, does not get visually
displayed.
Best wishes,
A.D.Tejpal
Sample Query
(Parameter with default value)
==================================
SELECT T_Sales.*
FROM T_Sales WHERE (((Year([SDate]))=Fn_SalesYear())); ==================================
User Defined Function -
Fn_SalesYear()
(Used in sample query above)
==================================
Function Fn_SalesYear() As Long
Fn_SalesYear = Val(InputBox("Enter Sales Year " & _ "(Default = Current Year)", "Sales Year", _ Year(Date))) End Function ==================================
Please zip all files prior to uploading to Files section. YAHOO! GROUPS LINKS
|
- [AccessDevelopers] ? on Parametr query with a default value ?... eliotchs
- RE: [AccessDevelopers] ? on Parametr query with a defaul... Tobi Hoffman
- Re: [AccessDevelopers] ? on Parametr query with a defaul... A.D.Tejpal
