Thanks for the suggestion, but I think I'm mixed up. Anyway, I have here
my
coding:
DoCmd.OpenForm "Income Statement Subform", acNormal, , DatePart("m",
Forms![Income Statement Subform]![Voucher_Date]) = 1
I have a crosstab query of Yearly Income Statement. Everytime I open the
query, it ask what year will it show and when I inputed a year, the result
shows the Account Description and its corresponding Amount for January,
February, March and so on. What I did was, I made a form for this query.
What
I would like to happen to the form is that when I click in field name
JANUARY, I want the form "INCOME STATEMENT SUBFORM" to open and show only
the
records for the month of JANUARY 2004. Please note that 2004 is the
inputed
year in the query awhile ago.
I would appreciate it very much if you could help me with my problem.
Thanks
so much.
Ken Snell (MVP) said:
Generally, it would be something like this:
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=SomeValue"
If you want to use a value from a control or variable, then this:
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
Note that the syntax varies if the field type is numeric, date, or text:
Numeric:
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
Text (delimit with ' character):
DoCmd.OpenForm "FormName", acNormal, , "NameOfField='" & VariableName &
"'"
Date/Time (delimit with # character):
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=#" &
Format(VariableName, "m\/d\/yyyy") & "#"
or
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" &
Format(VariableName,
"\#m\/d\/yyyy\#")
--
Ken Snell
<MS ACCESS MVP>
Hello there!
In access visual basic, I would like to ask how would I enter a where
condition in a Docmd function, filtering a specific month and year.
Example:
Docmd.Openform "formname", acNormal,,(WHERE CONDITION)
I would appreciate it very much if you could help me with my problem.
Thank
you.