Solved

Access 2010 Question

Posted on 2013-01-24
6
281 Views
Last Modified: 2013-01-24
I have a form with 9 buttons on it.  What i need to do is when you click on any of the buttons on form1 it will open form2 and only show the records based on that button.

if button1 on form1 is for experts then it will open form2 and only have the records for experts available.

if button2 on form1 is for novice then it will open form2 and only have the records for novices available.

and so on.

Is that possible and how do you do it?
0
Comment
Question by:Mark Wood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 38815548
Yes.  In the Click event of each button, write VBA code that opens the form, and then filters on the [SomeValue] field for all rows where that value is 'Experts' (change the names to meet your needs)

DoCmd.OpenForm "Forma Name", acnormal, "[SomeValue]='Experts'"

btw 'Access 2010 Question' is a poor choice for a subject, as it doesn't say anything about your question, and since you posted it in the Access zone we already know it's about Access.  
'How to open forms in VBA and filter' would be much better.
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38815652
i think this is a complicated question if you want to do it effeciently

You would make a click event as stated above for each button, then set the dataset to the table accordingly


IE


Sub Button1click (...bla) handles button1.click
  Form2.show()
  Form2.grid.datasource = datasource1
end sub

Sub Button2click (...bla) handles button2.click
  Form2.show()
  Form2.grid.datasource = datasource2
end sub

..etc
0
 
LVL 2

Author Comment

by:Mark Wood
ID: 38815750
ok i entered the code as follows:
DoCmd.OpenForm "IA Control Details", acNormal, "[IA Controls]![Control Level]='MAC 1 Classified'"

it returns all 1310 records instead of the 173 it should be. I have created queries that show me how many records there are for each level.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 2

Author Comment

by:Mark Wood
ID: 38816198
I got it working using the following

DoCmd.OpenForm "IA Control Details", , , "[Control Level]='MAC 1 Classified'"
0
 
LVL 2

Author Closing Comment

by:Mark Wood
ID: 38816203
Thanks
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38816249
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question