Results 1 to 4 of 4
  1. #1
    apk19 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    30

    OpenForm opens highlighted entry

    I have a subform in Datasheet view with a very simply OpenForm code that links to another form:



    DoCmd.OpenForm "Applicants", , , "ClientID = '" & Me.ClientID & "'"

    Only problem is that when I click to open, it opens only the highlighted entry of the subform, which in most cases is the first entry in the subform. I realised that I have to click on the particular subform entry, then click the "GoTo" box I created to open the right form.

    Is there any simple coding I can add where, upon clicking the "GoTo" box, it will highlight the entry first? I have attached the problem in a screenshot to help explain?

    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	27.6 KB 
ID:	25196

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    DoCmd.OpenForm "Applicants", , , "ClientID = '" & Me.ClientID & "'"
    if clientID is a number then it should be
    Code:
    DoCmd.OpenForm "Applicants", , , "ClientID = " & Me.ClientID
    Also no need for a separate button, just put this code in the subform current event or a single or double click event for one or more of the controls on the subform - I usually format the control as blue underline so it looks like a hyperlink.

  3. #3
    apk19 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    30
    Hi Ajax,

    Client ID is a short text field, so the code worked. It isn't a button, it's an unbound blank box.

    The problem is not command. The problem is that I have to individually highlight the record, then click the box to open the correct form.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    sorry, I don't understand the requirement, perhaps put some dummy data in your graphic and then explain how the process works again. At the moment I'm visualising you have a datasheet something like

    Applicant........GoTo
    Mr Smith........Edit Form
    Mr Smith........Delete Form
    Mr Jones........Edit Form
    Mr Jones........Delete Form

    or is the goto column a separate subform?

    and please explain where your code is - in the subform current event? a control click event or what?

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

Similar Threads

  1. now to set a field to be highlighted
    By BobW2961 in forum Access
    Replies: 3
    Last Post: 05-23-2016, 05:49 PM
  2. Replies: 2
    Last Post: 03-17-2014, 09:01 AM
  3. Exporting to Excel - All Worksheets Highlighted
    By kristyspdx in forum Import/Export Data
    Replies: 3
    Last Post: 02-26-2013, 05:42 PM
  4. Replies: 7
    Last Post: 01-29-2012, 07:44 AM
  5. Rainbow color effect on textbox highlighted text
    By DanielHofer in forum Forms
    Replies: 1
    Last Post: 08-31-2011, 08:14 AM

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