I don’t know much of VBA/SQL. There are many commodities in my DB for which I need data as under
year-wise
upto a year
from a year to the present year
between certain years
I export the query result to Excel to make a table/chart which will be printed.
I used the following for all my text boxes. This returns result for the year I specify for the commodity.
Field: MyFieldName
Show: Unchecked
Criteria:
[MyFieldName] Like "*" & [Forms]![SearchForm]![MyTextBoxName] & "*" Or [Forms]![SearchForm]![MyTextBoxName] Is Null
Then I tried the following code for the text box(Year)
Field:
[MyYearField] Between [Forms]![SearchForm]![txtFrom] And [Forms]![SearchForm]![txtTo]
Show: Unchecked
Critreria: True
This didn’t work. Then I put this code under the field in my query
Field: MyYearField
Show: Checked
Criteria: Between [Forms]![SearchForm]![txtFrom] And [Forms]![SearchForm]![txtTo]
I typed the desired key words in the respective text boxes and also the years (From-To) in the input form. Upon hitting the button the query again asks for input for all text boxes. But the good thing is that the query returns the category of records for the years I specify. Any solution to avoid this duplicate input?
year-wise
upto a year
from a year to the present year
between certain years
I export the query result to Excel to make a table/chart which will be printed.
I used the following for all my text boxes. This returns result for the year I specify for the commodity.
Field: MyFieldName
Show: Unchecked
Criteria:
[MyFieldName] Like "*" & [Forms]![SearchForm]![MyTextBoxName] & "*" Or [Forms]![SearchForm]![MyTextBoxName] Is Null
Then I tried the following code for the text box(Year)
Field:
[MyYearField] Between [Forms]![SearchForm]![txtFrom] And [Forms]![SearchForm]![txtTo]
Show: Unchecked
Critreria: True
This didn’t work. Then I put this code under the field in my query
Field: MyYearField
Show: Checked
Criteria: Between [Forms]![SearchForm]![txtFrom] And [Forms]![SearchForm]![txtTo]
I typed the desired key words in the respective text boxes and also the years (From-To) in the input form. Upon hitting the button the query again asks for input for all text boxes. But the good thing is that the query returns the category of records for the years I specify. Any solution to avoid this duplicate input?