Avatar of Larry Brister
Larry Brister
Flag for United States of America asked on

MS Access Listbox Context Menu

On my listbox I would like to add a function to the Right Mouse Click.

Essentially I was it to say..."Remove Client from Visit"

On click run a Sub.
Microsoft AccessMicrosoft DevelopmentMicrosoft Applications

Avatar of undefined
Last Comment
Larry Brister

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jeffrey Coachman

Not sure about right-clicks in Access 2007/2010.

Why not just put this on a button?
So the user could just select the Record from the listbox, then click the button to "remove"...

The code would be something like this regardless:

Dim strSQL as string
strSQL ="DELETE * FROM YourTable WHERE ClientID=" & lstClient
Currentdb.execute strSQL, dbfailonerror
me.lstClient.requery


JeffCoachman
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

"Not sure about right-clicks in Access 2007/2010."

?
Dale Fye

Right clicks (shortcut menus) are not a problem in 2007, but have not tested with a 2010 listbox.
Your help has saved me hundreds of hours of internet surfing.
fblack61
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

All MenuBars (Menus, Toolbars & Right Click) port over to A2010 from A2003.

mx
Larry Brister

ASKER
Sorry for late get back.

Tested both answers.

Thanks