By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

help in two forms

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 12 '05 #2

P: n/a
Salad <oi*@vinegar.com> wrote in message news:<lk***************@newsread1.news.pas.earthli nk.net>...
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


I would like to readout all records from this year. All employed of year 1990.

Thanks, Mojca
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.