Solved

Access 2010 Question

Posted on 2013-01-24
6
273 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
  • 3
  • 2
6 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Author Comment

by:Mark Wood
Comment Utility
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
Comment Utility
Thanks
0
 
LVL 65

Expert Comment

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now