Results 1 to 5 of 5
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Go to specific record on another form

    Using A2003 and A2007.

    I have a file that includes a continuous form (FormC) that can be opened from one of several single forms(form1, form2 etc.). The single forms vary only slightly (variations of same product). The single form stays open after it opens the continuous formC. For some operations, (printing being the main one) I want to want to return focus from FormC to a record on the single form with a specific value for one field - (idquote). This is not necessarily the record that was on focus when single form was used to open formC.

    I use the following simple code:

    If Me.FrmPrev = Me.TSsel Then
    Dim idq As Long
    idq = Me.IDquoteSel ‘ idquote number on FormC


    DoCmd.close ‘closes continuous formC. - Single form1 or 2 or 3 is now active form

    DoCmd.GoToControl "idquote"
    DoCmd.FindRecord idq
    End If

    This works great for Form1. But, Forms3 and 2, I get this message:
    “Error 2110 Msoft Access cannot move the focus to the control idquote”.

    How can it work for one form and not the others? They are almost identical. On form2 itself, I inserted a docmd.GotoControl "IDquote”, DocmdFind etc. button and works fine there.

    Driving me up the wall. Any help much much appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Instead of multiple forms with slight variations, I would probably have one form with code that manages what is presented on the form depending on some parameter passed to the form.

    I've never used GoToControl. I use GetFocus method. But I expect would generate same error.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    Without going into detail, multiple forms are optimum in this case. Why am I getting the error on some forms and not the other?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I do not believe I have ever used the methods in your sample code before. I do not understand what you are trying to accomplish.

    Perhaps some DAO and the bookmark method are appropriate.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't know why.

    Have you considered form/subform arrangement?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Openig form to specific record.
    By lynthel in forum Forms
    Replies: 8
    Last Post: 04-20-2014, 03:30 PM
  2. Opening Form to a Specific Record
    By PPat in forum Forms
    Replies: 9
    Last Post: 04-24-2013, 08:47 PM
  3. Go To Specific Record on Form
    By burrina in forum Forms
    Replies: 4
    Last Post: 12-26-2012, 07:15 PM
  4. Open form to specific record
    By Two Gun in forum Forms
    Replies: 7
    Last Post: 11-09-2011, 10:00 AM
  5. Open Form to Specific Record
    By batowl in forum Forms
    Replies: 1
    Last Post: 04-08-2011, 10:10 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