A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Populate Form and subForms based on the user's selection from acombo box



 
 
Thread Tools Display Modes
  #1  
Old January 14th, 2010, 09:40 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

Hi,

I would like to create a MS access form that have form that shows
employee info (such as employee name, phone, manage, etc) and a
subform that have employee's traning records. The datasource of the
Form is from table Employee and the datasource of subform is from
table traming. I would like to have a combo box on the top of the Form
for user to select Employee name. When the employee name is selected
from combo box, the employee info can show in the form and the
employee training infor can show in subform.

I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.
  #2  
Old January 15th, 2010, 01:42 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Populate Form and subForms based on the user's selection from a combo box

On Thu, 14 Jan 2010 13:40:04 -0800 (PST), Frank wrote:

I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.


Delete the combo box, open the form in design view, and click the magic wand
icon on the toolbar so that it's selected. Then use the Combo Box icon. The
combo box wizard will open; one of the options is "use this combo box to find
a record". Choose that option.

Basically you need an *UNBOUND* combo box with some VBA code (or, in 2007, a
Macro) which will find the desired record. The wizard will set this up for
you.

If it doesn't work, post back with a description of what you did and with the
AfterUpdate event of the combo box.
--

John W. Vinson [MVP]
  #3  
Old January 18th, 2010, 11:42 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

On Jan 14, 5:42*pm, John W. Vinson
wrote:
On Thu, 14 Jan 2010 13:40:04 -0800 (PST), Frank wrote:
I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.


Delete the combo box, open the form in design view, and click the magic wand
icon on the toolbar so that it's selected. Then use the Combo Box icon. The
combo box wizard will open; one of the options is "use this combo box to find
a record". Choose that option.

Basically you need an *UNBOUND* combo box with some VBA code (or, in 2007, a
Macro) which will find the desired record. The wizard will set this up for
you.

If it doesn't work, post back with a description of what you did and with the
AfterUpdate event of the combo box.
--

* * * * * * *John W. Vinson [MVP]


Thank you, John! I created a form, then used the subform/subreport
toolbar to created three subforms. Form and suform work well. Then I
created 'UNBOUND' combo box. But I can't find the magic wand icon in
the toolbar.
Where is it?

Frank


  #4  
Old January 19th, 2010, 12:48 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Populate Form and subForms based on the user's selection from a combo box

On Mon, 18 Jan 2010 15:42:37 -0800 (PST), Frank wrote:

On Jan 14, 5:42*pm, John W. Vinson
wrote:
On Thu, 14 Jan 2010 13:40:04 -0800 (PST), Frank wrote:
I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.


Delete the combo box, open the form in design view, and click the magic wand
icon on the toolbar so that it's selected. Then use the Combo Box icon. The
combo box wizard will open; one of the options is "use this combo box to find
a record". Choose that option.

Basically you need an *UNBOUND* combo box with some VBA code (or, in 2007, a
Macro) which will find the desired record. The wizard will set this up for
you.

If it doesn't work, post back with a description of what you did and with the
AfterUpdate event of the combo box.
--

* * * * * * *John W. Vinson [MVP]


Thank you, John! I created a form, then used the subform/subreport
toolbar to created three subforms. Form and suform work well. Then I
created 'UNBOUND' combo box. But I can't find the magic wand icon in
the toolbar.
Where is it?


It's in the tool*box* - I have no idea where it is in your installation, it
can be moved. I'm also not sure if it's handled the same in 2007 (or what
version you have).
--

John W. Vinson [MVP]
  #5  
Old January 20th, 2010, 05:10 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

On Jan 18, 4:48*pm, John W. Vinson
wrote:
On Mon, 18 Jan 2010 15:42:37 -0800 (PST), Frank wrote:
On Jan 14, 5:42*pm, John W. Vinson
wrote:
On Thu, 14 Jan 2010 13:40:04 -0800 (PST), Frank wrote:
I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.


Delete the combo box, open the form in design view, and click the magic wand
icon on the toolbar so that it's selected. Then use the Combo Box icon.. The
combo box wizard will open; one of the options is "use this combo box to find
a record". Choose that option.


Basically you need an *UNBOUND* combo box with some VBA code (or, in 2007, a
Macro) which will find the desired record. The wizard will set this up for
you.


If it doesn't work, post back with a description of what you did and with the
AfterUpdate event of the combo box.
--


* * * * * * *John W. Vinson [MVP]


Thank you, John! I created a form, then *used the subform/subreport
toolbar to created three subforms. Form and suform work well. Then I
created 'UNBOUND' combo box. But *I can't find the magic wand icon in
the toolbar.
Where is it?


It's in the tool*box* - I have no idea where it is in your installation, it
can be moved. I'm also not sure if it's handled the same in 2007 (or what
version you have).
--

* * * * * * *John W. Vinson [MVP]- Hide quoted text -

- Show quoted text -


I use MS access2002. Thanks
  #6  
Old January 20th, 2010, 05:27 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

On Jan 20, 9:10*am, Frank wrote:
On Jan 18, 4:48*pm, John W. Vinson





wrote:
On Mon, 18 Jan 2010 15:42:37 -0800 (PST), Frank wrote:
On Jan 14, 5:42*pm, John W. Vinson
wrote:
On Thu, 14 Jan 2010 13:40:04 -0800 (PST), Frank wrote:
I have created the Form and subform using Form and subform relation,
but when the combox was added to select employee name, the application
can not work anymore. Any suggestion is appreciated.


Delete the combo box, open the form in design view, and click the magic wand
icon on the toolbar so that it's selected. Then use the Combo Box icon. The
combo box wizard will open; one of the options is "use this combo box to find
a record". Choose that option.


Basically you need an *UNBOUND* combo box with some VBA code (or, in 2007, a
Macro) which will find the desired record. The wizard will set this up for
you.


If it doesn't work, post back with a description of what you did and with the
AfterUpdate event of the combo box.
--


* * * * * * *John W. Vinson [MVP]


Thank you, John! I created a form, then *used the subform/subreport
toolbar to created three subforms. Form and suform work well. Then I
created 'UNBOUND' combo box. But *I can't find the magic wand icon in
the toolbar.
Where is it?


It's in the tool*box* - I have no idea where it is in your installation, it
can be moved. I'm also not sure if it's handled the same in 2007 (or what
version you have).
--


* * * * * * *John W. Vinson [MVP]- Hide quoted text -


- Show quoted text -


I use MS access2002. Thanks- Hide quoted text -

- Show quoted text -


Hi Jonh,

I have created the 'UNBOUND' combo. Would you let me know VA code
associated in order to work?

Thanks

Frank
  #7  
Old January 20th, 2010, 05:53 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Populate Form and subForms based on the user's selection from a combo box

On Wed, 20 Jan 2010 09:27:45 -0800 (PST), Frank wrote:

Hi Jonh,

I have created the 'UNBOUND' combo. Would you let me know VA code
associated in order to work?

Thanks


Not without knowing more about your database: if you'll post the SQL view of
the Form's Recordsource and the combo box's RowSource I might be able to help.

--

John W. Vinson [MVP]
  #8  
Old January 20th, 2010, 10:14 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

On Jan 20, 9:53*am, John W. Vinson
wrote:
On Wed, 20 Jan 2010 09:27:45 -0800 (PST), Frank wrote:
Hi Jonh,


I have created the 'UNBOUND' combo. Would you let me know VA code
associated in order to work?


Thanks


Not without knowing more about your database: if you'll post the SQL view of
the Form's Recordsource and the combo box's RowSource I might be able to help.

--

* * * * * * *John W. Vinson [MVP]


The Form's Recordsource is Employee (a table). The combo box's
RowSource is SELECT Employee.EMPLOYEE FROM Employee;
Basically, I have Form of Employee and subform Training and subform
Audit. Pls let me know if you need additional info.

Thanks Jonh for your help!

Frank
  #9  
Old January 20th, 2010, 11:05 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Populate Form and subForms based on the user's selection from a combo box

On Wed, 20 Jan 2010 14:14:56 -0800 (PST), Frank wrote:

On Jan 20, 9:53*am, John W. Vinson
wrote:
On Wed, 20 Jan 2010 09:27:45 -0800 (PST), Frank wrote:
Hi Jonh,


I have created the 'UNBOUND' combo. Would you let me know VA code
associated in order to work?


Thanks


Not without knowing more about your database: if you'll post the SQL view of
the Form's Recordsource and the combo box's RowSource I might be able to help.

--

* * * * * * *John W. Vinson [MVP]


The Form's Recordsource is Employee (a table). The combo box's
RowSource is SELECT Employee.EMPLOYEE FROM Employee;
Basically, I have Form of Employee and subform Training and subform
Audit. Pls let me know if you need additional info.

Thanks Jonh for your help!

Frank


Do you have an EmployeeID? Or is the employee table just one field with "G.
Gordon Liddy" in the EMPLOYEE field? If so, what will you do if you have an
employee change their name (say by marriage), or get two employees who happen
to have the same name? I once worked at a university where there was a
Professor John W. Vinson... he got a much bigger salary than I did at the
time.

That said, you can put code in the Combo's AfterUpdate event such as:

Private Sub cboFindEmployee_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "Employee = """ & Me!cboFindEmployee & """"
If rs.NoMatch Then
MsgBox "Something wrong, employee not found!"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub

--

John W. Vinson [MVP]
  #10  
Old January 20th, 2010, 11:44 PM posted to microsoft.public.access.forms
Frank[_26_]
external usenet poster
 
Posts: 13
Default Populate Form and subForms based on the user's selection from acombo box

On Jan 20, 3:05*pm, John W. Vinson
wrote:
On Wed, 20 Jan 2010 14:14:56 -0800 (PST), Frank wrote:
On Jan 20, 9:53*am, John W. Vinson
wrote:
On Wed, 20 Jan 2010 09:27:45 -0800 (PST), Frank wrote:
Hi Jonh,


I have created the 'UNBOUND' combo. Would you let me know VA code
associated in order to work?


Thanks


Not without knowing more about your database: if you'll post the SQL view of
the Form's Recordsource and the combo box's RowSource I might be able to help.


--


* * * * * * *John W. Vinson [MVP]


The Form's Recordsource is Employee (a table). The combo box's
RowSource is SELECT Employee.EMPLOYEE FROM Employee;
Basically, I have Form of Employee and subform Training and subform
Audit. Pls let me know if you need additional info.


Thanks Jonh for your help!


Frank


Do you have an EmployeeID? Or is the employee table just one field with "G.
Gordon Liddy" in the EMPLOYEE field? If so, what will you do if you have an
employee change their name (say by marriage), or get two employees who happen
to have the same name? I once worked at a university where there was a
Professor John W. Vinson... he got a much bigger salary than I did at the
time.

That said, you can put code in the Combo's AfterUpdate event such as:

Private Sub cboFindEmployee_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "Employee = """ & Me!cboFindEmployee & """"
If rs.NoMatch Then
* *MsgBox "Something wrong, employee not found!"
Else
* *Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub

--

* * * * * * *John W. Vinson [MVP]- Hide quoted text -

- Show quoted text -


I created the VB code similar to the code you suggested in combo box
(see code below), But it does not work. When an employee name is
selected from combox box, the form and subforms are not refreshed.

Frank


Private Sub Select_Employee_AfterUpdate()

Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "Employee = """ & Me!Select_Employee & """"
If rs.NoMatch Then
MsgBox "Something wrong, employee not found!"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.