Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17

    How to open form on specific field

    I have a lookup macro to open a form when the selected field is clicked. I was able to use OpenForm Macro and use the where condition to open the correct record. However, the 2nd macro I put in place is not working. I used GoToControl and selected the field I wanted to be on when the form opened. What am I doing wrong? Do I need to continue the OpenForm where condition to include which field to land on when it opens the new form? The form I am trying to open is Main Form. The field I am trying to place the cursor on when the form opens is Abuser Name.

  2. #2
    matt_wpg is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    20
    Having the exact same problem! I hope we get an answer here...

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Typically you wouldn't use code, you'd make the desired control first in the tab order.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    The field is different depending on what they choose in another field.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Then I would expect GoToControl to work, though I don't use macros. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    I have tried the GoToControl and it doesn't work.

  7. #7
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    I don't know how to attach.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Do a compact/repair, the zip the file. Then you should be able to attach it in the "Go Advanced" area.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17

    Database

    I have attached it as a zip. I am new to this so you will probably find it is very basic.
    Attached Files Attached Files

  10. #10
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    I also have this question since you can see my database. Hopefully you can help with it as well:
    I have set my form up to have several pages. However, when I move from page to page, it doesn't always begin at the top. I have tried maximize page on click and it doesn't seem to work for pages. What do I enter to have it go to the first tab on the page as you select the page and where do I attach it?

  11. #11
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    I attached it. When you go to lookup a client, you can click on the client name and it will take you to the specific record on the main form. However, I also need it to go to the actual field where the client name is located.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not sure what you're having trouble with. I added GoToControl after your OpenForm and put [Client Name] as the control name, and it appears to work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Option Compare Database
    Option Explicit


    Private Sub Client_Change()
    Select Case Client.Value
    Case 0, 1, 3, 4
    [Client Name].SetFocus
    Case 2
    txtDummy.SetFocus
    End Select
    End Sub


    Private Sub Command726_Click()
    DoCmd.GoToRecord , , acNewRec
    End Sub
    Code is for Main Form
    Remove all the on_click embedded macros for ALL the tabs at the top.
    on tab Client Data, add a textbox named txtDummy at the top: height .001, Width .001, Top 0, Left 0, background transparent. You may have to remove layout for the entire tab contents to do that.
    Command726 was existing code.

  14. #14
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    I wasn't using the brackets. That is all I needed. THANK YOU!

  15. #15
    krigsby is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    17
    What about this question? Can you help with this as well?
    I have set my form up to have several pages. However, when I move from page to page, it doesn't always begin at the top. I have tried maximize page on click and it doesn't seem to work for pages. What do I enter to have it go to the first tab on the page as you select the page and where do I attach it?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open a Form up to a specific field
    By djclinton15 in forum Forms
    Replies: 12
    Last Post: 12-21-2015, 06:54 PM
  2. Close one form open another and set focus to a specific field
    By Derrick T. Davidson in forum Programming
    Replies: 12
    Last Post: 08-01-2014, 05:16 AM
  3. Replies: 1
    Last Post: 08-20-2013, 02:17 PM
  4. Open an external folder specific by a form field
    By AccessNoob16 in forum Forms
    Replies: 11
    Last Post: 04-09-2012, 01:30 PM
  5. Replies: 7
    Last Post: 11-29-2009, 01:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums