form

B

belczyk

I have 30 sections in my office, i have a database with a form for
each section. How do i create a form that will let them choose their
section from a pull down and open their form based on their section
selection.
 
S

Scott McDaniel

I have 30 sections in my office, i have a database with a form for
each section. How do i create a form that will let them choose their
section from a pull down and open their form based on their section
selection.


You could use a combobox with each section listed, then use the AfterUpdate
event to open the form based on the user's choice. For example, set the
combo's RowSourceType to Value List, then add this in the RowSource:

Section 1;Section 2;Section 3 etc etc

Then, in the AfterUpdate event of the combo (I'll name the combo
cboChooseSection):

Sub cboChooseSection_AfterUpdate()
Select Case me.cboChooseSection.Column(0)
Case "Section 1"
DoCmd.OpenForm "fmSection1"
Case "Section 2"
Docmd.OpenForm "frmSection2"
Case Else
End Select
End Sub

Of course, you'll need to change the names of the forms and such to match
those in your project.
 
S

Steve

Consider putting all your data in two tables:
TblSection
SectionID
SectionName

TblMyData
MyDataID
SectionID
<<Fields for all your data>>

Next you need a query that includes both fields with the following criteria
for SectionID:
Forms!PFrmSelectSection!SectionID

You then need a form, FrmSectionData, based on the query.

Next to last you need a pop-up form named PFrmSelectSection with a combobox
named SectionID. The rowsource of the combobox needs to be the following
SQL:
Select SectionID, SectionName From TblSection OrderBy SectionName
The properties of the combobox need to be:
BoundColumn 1
Column Count 2
Column Width 0;2

In the AfterUpdate event of the combobox you need the following code:
Me.Visible = False

Lastly, you need the following code to open PFrmSelectSection:
DoCmd.OpenForm "PFrmSelectSection",,,,,acDialog
DoCmd.OpenForm "FrmSectionData"
Docmd.Close "PFrmSelectSection"

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(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