Results 1 to 6 of 6
  1. #1
    djclinton15 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    123

    Open a Form to a Particular Designated Field

    I Cansuccessfully open a Form to a designated particular field if it's a New Record.



    PrivateSub Form_Load()
    DoCmd.GoToRecord , , acNewRec
    Me.DayTime.SetFocus
    EndSub

    However,what if I wanted to open a Form to a designated field say in the First Record?

    Itried replacing 'acNewRec' with 'acFirstRec' but it didn't work.

    PrivateSub Form_Load()
    DoCmd.GoToRecord , , acFirstRec
    Me.DayTime.SetFocus
    EndSub

    *Am Ito assume that one can only open a Form to a designated particular field ifit's a New Record?

    Anyadvice/suggestions will be greatly appreciated! Thanks in advanced.

  2. #2
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    would it be easier to just use the set order by method?
    https://msdn.microsoft.com/en-us/lib...ffice.15).aspx

    private sub form_load()
    docmd.setorderby"id ASC"
    end sub

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Your argument should be

    acFirst

    not

    acFirstRec

    But why move to the first Record on opening the Form...the Form will open on the first Record...automatically!
    Code:
    PrivateSub Form_Load()
      DayTime.SetFocus
    EndSub

    Linq ;0)>

  4. #4
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    hmmmm - if you seek to open the form and have the focus on a specific field/control - - one can accomplish that using the tab order of the form; no code is needed at all.....

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by NTC View Post
    hmmmm - if you seek to open the form and have the focus on a specific field/control - - one can accomplish that using the tab order of the form; no code is needed at all.....
    I took the OP's explanation to mean that he wanted an existing Record to open to one Field/Control and a New Record to a different Field/Control, but I could be wrong! I've done this a time or two, when all data needed to be entered for a New Record, of course, but only one or two Fields, typically, needed to be updated, on existing Records.

    Linq ;0)>

  6. #6
    djclinton15 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    123
    First, thanks to all for responding to my thread! No Ling, you were partially right the first time in thinking that I wanted 'an existing Record to open to one Field/Control.' One would assume (even I) a simple solution would be changing the tab order & placing the desire field/control at the top. However, in doing just that, the Form still opens up in the first first field/control vs. the designated field/control I'vs set in the tab order. Needless to say, I'm quite pondered & frustrated in something to rectify this issue.

    Hoping without need to go into depth, I have a Table of music artists/for which I daily listen to & are pre-dated. I also track the duration (length of time I play/listen to the artists/group on the current date. I created a Form (datasheet viewed) displaying the day, the current/today's date, the ArtistsID, & the duration (empty). Therefore, each day AL I need to input/update in this Form is the Duration field/control played per ArtistsID. It wouldn't be far-fetch to want to have this Form open up in the Duration field/control beings that's the only field empty. Beings the Duration field/control only requiring daily updating, which might be be understandable why I would want the Form to open up in the field/control

    Please excuse my lengthy explanation; I'm just trying to provide a better picture/understanding on my objective.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-05-2016, 03:04 PM
  2. Form opening to different than designated
    By finlain in forum Forms
    Replies: 2
    Last Post: 02-18-2016, 01:31 PM
  3. Replies: 3
    Last Post: 07-10-2013, 08:54 AM
  4. Forms designated for edit only
    By GAccess in forum Forms
    Replies: 7
    Last Post: 05-09-2012, 11:54 AM
  5. Replies: 7
    Last Post: 01-12-2011, 08:59 AM

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