?
Solved

Access 2010 Question

Posted on 2013-01-24
6
Medium Priority
?
282 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 2000 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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 …
Suggested Courses

771 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