Mojca wrote:
I would need a little help or example on formulation of two forms.
On the first one I would like to chose from Combo box »Year of
Occupation« (properties of this combo box - row source type is Value
List, for example 1990 - 2004) and then press on the OK button .
Button OK opens other form in which I enter all data of employees,
in field »Year of Occupation« which it exists in the table Employed
automatically writes out only year, which I have chosen in the first
form (for example 1990 ).
Thank you for your help, Mojca
Let's say the combo box is called ComboYear, the field to limit is
called OccYear, the form to open called Employee
In the OnClick Event it would look something like this
Private Sub CommandOK_Click
Dim strFilter As STring
If Not IsNull(Me.ComboYear)
'show only for year, if null show all
strFilter = "[OccYear] = " & Me.comboYear
ENdif
DOcmd.openform Employee,,,strFilter
ENd Sub
you could also do something like
Private Sub CommandOK_Click
Dim strFilter As STring
If Not IsNull(Me.ComboYear)
'show only for year, if null show all
strFilter = "[OccYear] = " & Me.comboYear
ENdif
DOcmd.openform Employee
FOrms!Employee.Form.Filter = strFilter
FOrms!Employee.Form.FilterOn = (strFilter > "")
ENd Sub