Solved

Access 2010 Question

Posted on 2013-01-24
6
275 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
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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 65

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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 how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

895 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

16 Experts available now in Live!

Get 1:1 Help Now