makinf subform on the basis of a combo box selection

G

Guest

hi
i have different tables named employee having info of all the employees,
table managers with information of managers, table projects with information
of projects and name of emp who r working on that project with their manager
name

i wan to make 2 forms in one form just the information of all the managers
and came as a list, when they pick their name from the list, and the project
name from the list , the sub form should show the list of all the employees
who are working on that project with that particular manager. pls pls help me
and send me the full detail that how can i make and call subform from a form
, i have tried it but i failed to do so pls help me in this topic and send
the info on my mail id (e-mail address removed)
 
G

Guest

Hi Ritu

1st you need to ensure that both tables are linked –

tblManagers – ID, 1stName,Surname, plus other information
tblEmployees – ID, 1stName,Surname, [tblManagers]![ID] (linking field from
tblManagers), plus other information

Open the relationships window and drag the Managers ID field into the
tblEmployees to create the relationship. Save and close the window.

Next create a query to manipulate the data from tblManagers, then create a
form from this (use the wizard if you want).
Create another query and form in the same way from tblEmployees ensuring
that you have the linking field in the grid of the query and the form. Set
this form to be either datasheet or continous forms.

Open frmManagers in design view and use the wizard to insert a subform –
select use form and select frmEmployees.

On frmManagers create an unbound combobox and use the wizard to use it to
find the manager you wish to view.

Or – create the unbound combo and put something like this behind the
AfterUpdate action (on the event column of the properties box)

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ManagerID] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

After you select a manager from the list in the combo box a list of
employees will appear in the subform

Hope this helps
 
G

Guest

it is rally good and explained but when i m making form on the basis of query
it is not showing me the records


Wayne-I-M said:
Hi Ritu

1st you need to ensure that both tables are linked –

tblManagers – ID, 1stName,Surname, plus other information
tblEmployees – ID, 1stName,Surname, [tblManagers]![ID] (linking field from
tblManagers), plus other information

Open the relationships window and drag the Managers ID field into the
tblEmployees to create the relationship. Save and close the window.

Next create a query to manipulate the data from tblManagers, then create a
form from this (use the wizard if you want).
Create another query and form in the same way from tblEmployees ensuring
that you have the linking field in the grid of the query and the form. Set
this form to be either datasheet or continous forms.

Open frmManagers in design view and use the wizard to insert a subform –
select use form and select frmEmployees.

On frmManagers create an unbound combobox and use the wizard to use it to
find the manager you wish to view.

Or – create the unbound combo and put something like this behind the
AfterUpdate action (on the event column of the properties box)

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ManagerID] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

After you select a manager from the list in the combo box a list of
employees will appear in the subform

Hope this helps


--
Wayne
Manchester, England.
Enjoy whatever it is you do


ritu said:
hi
i have different tables named employee having info of all the employees,
table managers with information of managers, table projects with information
of projects and name of emp who r working on that project with their manager
name

i wan to make 2 forms in one form just the information of all the managers
and came as a list, when they pick their name from the list, and the project
name from the list , the sub form should show the list of all the employees
who are working on that project with that particular manager. pls pls help me
and send me the full detail that how can i make and call subform from a form
, i have tried it but i failed to do so pls help me in this topic and send
the info on my mail id (e-mail address removed)
 
G

Guest

hi thanks for ur help
but pls tell me why this code is not working for me
i did as u said , sub form is ok but it is not populated acc to the name of
the manager
as i wan to make it clear that i m using the manager id as a foreign key of
employee id
as i have no idea of vb i do't know how to use it can u pls tell me .
plsssssssssss

Wayne-I-M said:
Hi Ritu

1st you need to ensure that both tables are linked –

tblManagers – ID, 1stName,Surname, plus other information
tblEmployees – ID, 1stName,Surname, [tblManagers]![ID] (linking field from
tblManagers), plus other information

Open the relationships window and drag the Managers ID field into the
tblEmployees to create the relationship. Save and close the window.

Next create a query to manipulate the data from tblManagers, then create a
form from this (use the wizard if you want).
Create another query and form in the same way from tblEmployees ensuring
that you have the linking field in the grid of the query and the form. Set
this form to be either datasheet or continous forms.

Open frmManagers in design view and use the wizard to insert a subform –
select use form and select frmEmployees.

On frmManagers create an unbound combobox and use the wizard to use it to
find the manager you wish to view.

Or – create the unbound combo and put something like this behind the
AfterUpdate action (on the event column of the properties box)

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ManagerID] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

After you select a manager from the list in the combo box a list of
employees will appear in the subform

Hope this helps


--
Wayne
Manchester, England.
Enjoy whatever it is you do


ritu said:
hi
i have different tables named employee having info of all the employees,
table managers with information of managers, table projects with information
of projects and name of emp who r working on that project with their manager
name

i wan to make 2 forms in one form just the information of all the managers
and came as a list, when they pick their name from the list, and the project
name from the list , the sub form should show the list of all the employees
who are working on that project with that particular manager. pls pls help me
and send me the full detail that how can i make and call subform from a form
, i have tried it but i failed to do so pls help me in this topic and send
the info on my mail id (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top