Results 1 to 6 of 6
  1. #1
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    move to home automatically (office 2000)

    on a form, I have a command button [NEW RECORD], This runs a macro which uses the RunCommand function and the
    run command is setup for RecordsGoToNew {this is the command that runs} when I am in the new record I have to
    hit the key marked HOME and this places me at the first field on the record. Is there a way to get access to go to this field
    automatically so I do not have to hit the HOME KEY every record ? I have tried a few tricks, but nothing works. <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: move to home automatically (office 2000)

    Focus should move automatically to the first control in the tab order.

    You can also use the GoToControl command in your macro to put the cursor in the field you want.
    Add this as a new line in the macro, after the Runcommand line, then enter the name of the control.
    Regards
    John



  3. #3
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move to home automatically (office 2000)

    I did check the tab order and the first line VendorName is were I would like to end up every time I select New Record
    under properties for the button it shows an event procedure, I tried to add an new line to get the Cursor to goto the top or VendorName.
    I can press the HOME KEY and it will but when I come into the new record the Cursor is not at the top.
    THE EVENT PROCEDURE FOR THE BUTTON TO FOLLOW:
    Private Sub EnterNewRecordButton_click()
    On Error GotoErr_EnterNewRecordButton_Click

    DoCmd.GoToRecord , , acNewRec

    Exit_EnterNewRecordButton_Click:
    Exit Sub

    Err_EnterNewRecordButton_Click:
    MsgBox Err.Description
    Resume Exit_EnterNewRecordButton_Click

    I did try adding the line below the DoCmd Line

    DoCmd.GotoControl , , VendorName
    DoCmd.GotoControl (VendorName)

    None of these worked ? But I really do not know what I am doing in VB
    I also tried adding the second line to the Macro, but the Cursor did not move home or to the first field entry, which is VendorName ???
    Thanks for the attempt at helping me on this problem. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

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

    Re: move to home automatically (office 2000)

    The argument to DoCmd.GoToControl is a string, so you should use

    DCmd.GoToControl "VendorName"

    You can also use the SetFocus method of the control:

    Me.VendorName.SetFocus

    Note that you should not use quotes here. You can learn more about GoToControl and SetFocus by clicking in one of these words and pressing F1.

  5. #5
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move to home automatically (office 2000)

    A short thank you for the assistance, It worked great ! ! !
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: move to home automatically (office 2000)

    Just a comment that might be relevant for any future postings you make.

    In Access Macros and Event Procedures are not the same. They are alternative methods of doing things.

    Macros will be listed in the database window in the Macros tab.

    Because you said that you were using a macro, I described a macro solution, rather than an event procedure solution.
    Regards
    John



Posting Permissions

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