Results 1 to 11 of 11
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Goto Control (A2k)

    <P ID="edit" class=small>(Edited by D Willett on 29-Jun-03 11:31. )</P>In our existing DOS database, we use F9 to backspace to a previous field.

    Is there a simple way to achieve this in VBA.
    Is it something like: DoCmd.GotoControl acPrev ???

    I know there is a sendkeys function, but have bad remarks about this function :

    SendKeys "{backspace}"
    ****************************
    Just realised, SendKeys "{backspace}" does exactly as the backspace key does,
    *************************

    Or can this be achieved by Dimming the tab order ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Goto Control (A2k)

    Dave,

    By far the easiest solution is to teach your users to use Shift+Tab to go to the previous control in the tab order.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Goto Control (A2k)

    Hans
    I knew that combination but, you know what users are like !!

    This combination could be achieved again with the sendkeys method, but how reliable would it be.?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Goto Control (A2k)

    Dave,

    I will try to find a solution using F9, but it won't be before tonight.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Goto Control (A2k)

    Thanks Hans
    I'm going soon too, the floors are nearly done now.
    Enjoy the rest of the day.

  6. #6
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Goto Control (A2k)

    Recommend try using AutoKeys macro to redefine F9 key for your app. Create new macro. In Macro Name column enter the keystrokes you wish to "divert". In Action column select "SendKeys". For Action Arguments enter the action you want keystrokes in Macro Name column to perform. In this case, enter following:

    Macro Name: {F9}
    Action: SendKeys
    Action Argument: +{TAB}

    Save macro as "AutoKeys". Now when you tab thru a form, pressing F9 key will be equivalent to Shift + TAB, focus will move to previous field in Tab order. Check help file for SendKeys Statement (VBA reference) for more info on SendKeys syntax (for example, "+" = SHIFT, "^" = CTRL, "%" = ALT, etc.) You can use this macro to "redefine" any number of valid keys in your db (some keys you are not allowed to use in AutoKeys, such as ESC key).

    HTH

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Goto Control (A2k)

    Clinging to slavishly to the way the old application worked will cause you problems down the line, Dave. You need to do some retraining of your users. DOS-based apps worked differently and there weren't really any "standard" function key assignments except possibly within a single publisher's applications. In MS apps, F9 does have a fairly standard assignment to recalculate. You can remap it in your mdb, but that will ultimately cause confusion in other applications, where it will not be remapped and will not function as a back tab.
    Charlotte

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Goto Control (A2k)

    Dave,

    1. As Charlotte remarked, your users should get used to Windows someday, and Shift+Tab is used in virtually every Windows application to go back, so it will only benefit them to learn this shortcut. You can always help them by putting "Tab = next field" and "Shift+Tab = previous field" somewhere on your form.

    2. MarkD's suggestion to use an AutoKeys macro will work well. but be aware that it will make F9 act as Shift+Tab throughout your database. If that is what you intend, use it, for you won't have to write code for each individual form that way, but make sure that it won't have unexpected side effects.

    3. If you want to let F9 act as Shift+Tab in a specific form, set the KeyPreview property of that form to Yes and add the following code to the KeyDown event of the form:

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyF9
    SendKeys "+{TAB}"
    End Select
    End Sub

    If you already have other key assignments, just add the code for vbKeyF9 to the existing Select Case statement.

    4. For situations like this, SendKeys doesn't hurt, and it certainly is a lot less work than trying to work out how to get to the previous control yourself.

  9. #9
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Goto Control (A2k)

    Thankyou Hans,Mark,Charlotte.

    Your advice is noted and yes, I agree, training will be provided as and when needed.

    I have quite a few scenario's here, which already, I have implemented.

    I have an Autokey macro already in existance, basically de-functioning the Access default actions for all the keys.
    Just one of the two that I have been using for ages (Autoexec),(Autokeys), I'm sure turning the special keys off in options would do the same thing.

    From each form, there may be a different action for the function keys, although very similar globally, I assign different setfocus points and actions from form to form.

    If I have to go with any of the suggestions, it would have to be the Select Case version, which is already in use.

    My database is very key specific, and if I can reproduce the current operating environment without too much change, then I will have achieved my goal.

    Thankyou all once again.

  10. #10
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Goto Control (A2k)

    Adding to the chorus of advice, Dave:
    We built an application nearly 10 years ago in Access 2.0 Beta to replace a legacy system, and the client insisted that the user interface work virtually identically to the old system. We jumped through lots of hoops and got it pretty close. Then we spent the next 5 years undoing all the idiosyncrasies we had built in, and re-doing the user interface 3 times. And those changes were all at the client's request. Finally, we said them "Listen - let us design a prototype that really takes advantage of the Windows interface" and we did and they loved it. It cut data entry times dramatically and they continue to use it with only slight modifications 4 years later.

    Bottom line - take advantage of the power of the Windows/Access UI (unless you are looking for job security - and that's a slippery slope).
    Wendell

  11. #11
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Goto Control (A2k)

    Wendell
    Thanks for your advice and remember, the more voices in the chorus, the sweeter the sound !!
    Well in theory any way.

    I don't think the problem I have with the specific keys is deeply concerning ( I may be wrong against all the advice I am given) as they are pretty much uniform.

    F1 = Help form (Each form has it's own)
    F2 = Find record
    F3 = New Record
    F5 = Save Record
    F6 = Print Report
    F7 = Specific Menu (Specific to the residing form)
    F8 = Specific Menu, Only used on one form)
    F9 = This post
    F10 = Close current form
    F11 Not used
    F12 Not used

    Thats pretty much it.
    Only on a couple of occasions do they jump through hoops.
    I had a mega problem with this in A2000 where the Autokeys macro just refused to work, Looks like they've fixed it with XP.

    Again thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •