Adding Run Query to Context Menu Access 2010

I have a form in Access 2010 which is used for Timetable planning in a college. When assigning teaching staff to a particular slot it is useful for the planner to know how many periods that member of staff is already assigned to.
I've written a query which will list members of staff and the number of periods which they are teaching, but I would like for the user to be able to right click on a period and run the query filtered by the member of staff in the relevant period. For example, RDR is teaching a Maths class in period 1, so his initials are in the text box for period 1. The user right clicks on the period 1 text box, and selects "Query teacher" and this opens the query filtered for RDR.

How easy is this to do?
Karl_markAsked:
Who is Participating?
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPConnect With a Mentor Commented:
You can use VBA code to do what you want.

Attached is an example in 2003 format that will work in 2007 and later. It will show you how to do what you want.
ShortcutDemoForPosting-A2003.zip
0
 
Jeffrey CoachmanMIS LiasonCommented:
Right click menus are more difficult to create.

Why not just run this by clicking a button? (Much simpler)
0
 
Jeffrey CoachmanMIS LiasonCommented:
or simpler, display the results in a popup form in a listbox (to disallow edits)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
Karl_markAuthor Commented:
I've done that bit. It would just be nice to be able to right click and open the query!
0
 
Jeffrey CoachmanMIS LiasonCommented:
Then something like this should work in the most basic sense
Database107.mdb
0
 
Jeffrey CoachmanMIS LiasonCommented:
ooops, you wanted the right click...
...as I stated, these are trickier to make in Access 2010...

Let's see if another expert chimes in...
0
 
Karl_markAuthor Commented:
Thanks. Looks like it does the job and I can work it out!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.