Prev: "Exit Access" Code
Next: Scrolling in VBA module
From: Douglas J. Steele on 2 Apr 2010 09:38 No, I mean creating a macro named AutoKeys, adding a MacroName entry for the F1 key and assigning an action to that macro. http://office.microsoft.com/en-ca/access/HA102391111033.aspx?pid=CH100621381033 http://office.microsoft.com/en-ca/access/HP051866491033.aspx?pid=CH063664951033 The advantage is that you only need to do this in one place, and it's effective everywhere in your application, as opposed to having to call code in the KeyDown event of every form (plus remembering to set KeyPreview property for each form so that the form's KeyDown event intercepts the control's KeyDown event) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Jack Leach" <dymondjack at hot mail dot com> wrote in message news:64DE16B0-B77E-44B9-9B27-ED98BB8F1873(a)microsoft.com... > Do you mean the AutoHotKeys program that lets you script keystrokes on a > system or application level? This would have to be installed and > configured > on each computer the app is distributed to, correct? > > I've never used that with Access before... is there any particular > advantage > to this above using the KeyDown event? > > -- > Jack Leach > www.tristatemachine.com > > "I haven''t failed, I''ve found ten thousand ways that don''t work." > -Thomas Edison (1847-1931) > > > > "Douglas J. Steele" wrote: > >> You can also create an AutoKeys macro and map F1 to call a function. >> >> -- >> Doug Steele, Microsoft Access MVP >> http://www.AccessMVP.com/DJSteele >> (no e-mails, please!) >> >> "Jack Leach" <dymondjack at hot mail dot com> wrote in message >> news:1180E0A1-0110-437D-98F8-1B56D8CCBF72(a)microsoft.com... >> > ahhhhh... F1! I used a button on all my forms to open the help page, >> > but >> > I >> > think if you go to the Form's KeyDown event, you can capture F1 (I'm >> > not >> > exactly sure how to reference that particular key, but some testing >> > should >> > give an answer). >> > >> > Private Sub KeyDown(KeyCode As Integer, Shift As Integer) >> > If KeyCode = <F1 code> Then >> > KeyCode = 0 >> > DoCmd.OpenForm frmHelp etc etc >> > End If >> > End Sub >> > >> > that might get you started anyway... >> > >> > -- >> > Jack Leach >> > www.tristatemachine.com >> > >> > "I haven''t failed, I''ve found ten thousand ways that don''t work." >> > -Thomas Edison (1847-1931) >> > >> > >> > >> > "Dennis" wrote: >> > >> >> Jack, >> >> >> >> How did you capture the F1 function key (help key) for help or did you >> >> do >> >> something else? >> >> >> >> Dennis >> >> >> . >>
From: Jack Leach dymondjack at hot mail dot on 2 Apr 2010 11:06 Thanks Doug, I was never aware of this. A google search showed a bunch of stuff for AutoHotKeys, which I thought was an odd way to go about it (although I think it could be done using that, if not ideally). Always nice to learn about functionality I had no idea existed :-) -- Jack Leach www.tristatemachine.com "I haven''t failed, I''ve found ten thousand ways that don''t work." -Thomas Edison (1847-1931) "Douglas J. Steele" wrote: > No, I mean creating a macro named AutoKeys, adding a MacroName entry for the > F1 key and assigning an action to that macro. > http://office.microsoft.com/en-ca/access/HA102391111033.aspx?pid=CH100621381033 > http://office.microsoft.com/en-ca/access/HP051866491033.aspx?pid=CH063664951033 > > The advantage is that you only need to do this in one place, and it's > effective everywhere in your application, as opposed to having to call code > in the KeyDown event of every form (plus remembering to set KeyPreview > property for each form so that the form's KeyDown event intercepts the > control's KeyDown event) > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Jack Leach" <dymondjack at hot mail dot com> wrote in message > news:64DE16B0-B77E-44B9-9B27-ED98BB8F1873(a)microsoft.com... > > Do you mean the AutoHotKeys program that lets you script keystrokes on a > > system or application level? This would have to be installed and > > configured > > on each computer the app is distributed to, correct? > > > > I've never used that with Access before... is there any particular > > advantage > > to this above using the KeyDown event? > > > > -- > > Jack Leach > > www.tristatemachine.com > > > > "I haven''t failed, I''ve found ten thousand ways that don''t work." > > -Thomas Edison (1847-1931) > > > > > > > > "Douglas J. Steele" wrote: > > > >> You can also create an AutoKeys macro and map F1 to call a function. > >> > >> -- > >> Doug Steele, Microsoft Access MVP > >> http://www.AccessMVP.com/DJSteele > >> (no e-mails, please!) > >> > >> "Jack Leach" <dymondjack at hot mail dot com> wrote in message > >> news:1180E0A1-0110-437D-98F8-1B56D8CCBF72(a)microsoft.com... > >> > ahhhhh... F1! I used a button on all my forms to open the help page, > >> > but > >> > I > >> > think if you go to the Form's KeyDown event, you can capture F1 (I'm > >> > not > >> > exactly sure how to reference that particular key, but some testing > >> > should > >> > give an answer). > >> > > >> > Private Sub KeyDown(KeyCode As Integer, Shift As Integer) > >> > If KeyCode = <F1 code> Then > >> > KeyCode = 0 > >> > DoCmd.OpenForm frmHelp etc etc > >> > End If > >> > End Sub > >> > > >> > that might get you started anyway... > >> > > >> > -- > >> > Jack Leach > >> > www.tristatemachine.com > >> > > >> > "I haven''t failed, I''ve found ten thousand ways that don''t work." > >> > -Thomas Edison (1847-1931) > >> > > >> > > >> > > >> > "Dennis" wrote: > >> > > >> >> Jack, > >> >> > >> >> How did you capture the F1 function key (help key) for help or did you > >> >> do > >> >> something else? > >> >> > >> >> Dennis > >> > >> > >> . > >> > > > . >
From: Dennis on 3 Apr 2010 00:58 Doug, Very nice! I read the two links. I don't know much about macros, but I have quite a few Access books so I guess it is back to the learning cliff and bloody knuckles. But let me ask this. When I press the F1 key and the AutoKey macro fires, how would it know from which control item in which form the F1 key was pressed? Or another way to phrase this question, if I press the F1 in my Customer Name field, how would the F1 key know to bring up the Customer Name help page. I figure I would have to pass something to the macro so it would know. Dennis
From: Jack Leach dymondjack at hot mail dot on 3 Apr 2010 06:04 I'm just shooting in the dark here (AutoKeys macros are new to me as well), but I would assume that if your macro calls a function (someting like GetHelp()) that is the global help handler of your project, you could use Screen.ActiveForm and Screen.ActiveControl to determine where the user currently is. I suppose this would require a table of forms/controls and corresponding help indexes though... could be a pain to maintain. -- Jack Leach www.tristatemachine.com "I haven''t failed, I''ve found ten thousand ways that don''t work." -Thomas Edison (1847-1931) "Dennis" wrote: > Doug, > > Very nice! I read the two links. I don't know much about macros, but I > have quite a few Access books so I guess it is back to the learning cliff and > bloody knuckles. > > But let me ask this. When I press the F1 key and the AutoKey macro fires, > how would it know from which control item in which form the F1 key was > pressed? > > Or another way to phrase this question, if I press the F1 in my Customer > Name field, how would the F1 key know to bring up the Customer Name help > page. > > I figure I would have to pass something to the macro so it would know. > > Dennis >
From: Douglas J. Steele on 3 Apr 2010 13:23
ActiveControl would seem to be appropriate. ActiveForm might be misleading: if the control is on a subform, ActiveForm will actually be the parent form. Yes, if you wanted context-sensitive help, then you would need to have some way of mapping the specific control to specific help topics. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Jack Leach" <dymondjack at hot mail dot com> wrote in message news:FAC3294B-507D-4A2C-BCD3-8D61FD877E02(a)microsoft.com... > I'm just shooting in the dark here (AutoKeys macros are new to me as > well), > but I would assume that if your macro calls a function (someting like > GetHelp()) that is the global help handler of your project, you could use > Screen.ActiveForm and Screen.ActiveControl to determine where the user > currently is. > > I suppose this would require a table of forms/controls and corresponding > help indexes though... could be a pain to maintain. > > -- > Jack Leach > www.tristatemachine.com > > "I haven''t failed, I''ve found ten thousand ways that don''t work." > -Thomas Edison (1847-1931) > > > > "Dennis" wrote: > >> Doug, >> >> Very nice! I read the two links. I don't know much about macros, but I >> have quite a few Access books so I guess it is back to the learning cliff >> and >> bloody knuckles. >> >> But let me ask this. When I press the F1 key and the AutoKey macro >> fires, >> how would it know from which control item in which form the F1 key was >> pressed? >> >> Or another way to phrase this question, if I press the F1 in my Customer >> Name field, how would the F1 key know to bring up the Customer Name help >> page. >> >> I figure I would have to pass something to the macro so it would know. >> >> Dennis >> |