Results 1 to 4 of 4
  1. #1
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169

    Form on open in form view highlights a single row

    I have a pretty complex form full of multi-select listboxes and in my details section, I have what should be displayed. The issue is, when the form opens, it automatically has a row in the details highlighted in black and I am trying to figure out how to stop that from happening. Here is a screenshot of what I mean:




    Click image for larger version. 

Name:	Presentation1.jpg 
Views:	13 
Size:	99.5 KB 
ID:	17302

    Any advice?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    What exactly are you trying to prevent?

    Going to that particular cell?
    You don't want to highlight the entire contents you just want to go to the end of the string?
    You don't want that field to be editable?
    You don't want that field to be available at all other than visible?

    If you are trying to go to the end of the line so they don't accidentally overwrite what's in the field I use this function:

    Code:
    Public Function pfLP() '(ctl As Control, lngWhere As Long)
    On Error GoTo ERRHANDLER
    
    If Screen.ActiveControl.Enabled = True Then
        If InStr(Screen.ActiveControl.Tag, "ED") > 0 Then
            'ED in the string indicates a date value
            If IsNull(Screen.ActiveControl.Value) Then
                'Empty Date
                Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength
            Else
                'Date present with \ marks
                Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength + 2
            End If
        Else
            'other text or numeric field
            Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength
        End If
    End If
    Exit Function
    ERRHANDLER:
    Resume Next
    
    End Function
    You may have to modify it to look at a subform field, I don't use subforms so I'm not entirely sure if it would work without modification. NOTE this relies on any DATE field to have a tag of ED, I suppose you could change it to look and see if the field is formatted a particular way the tag function is just easier for me all around.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You might try setting the focus to a button in the header.

    Code:
    Private Sub Form_Load()
        Me.cboHideShow.SetFocus
    End Sub
    Change "cboHideShow" to your button name....

  4. #4
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169
    The me.cbohidshow.setfocus works perfect. Thanks.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-30-2014, 01:12 AM
  2. open form in a NOT maximzed view
    By markjkubicki in forum Forms
    Replies: 3
    Last Post: 09-30-2013, 07:48 AM
  3. Replies: 8
    Last Post: 04-29-2013, 11:23 AM
  4. Can't open form in form view?
    By mcnpr in forum Forms
    Replies: 3
    Last Post: 06-22-2011, 07:15 AM
  5. Form will not open View or Design
    By aldeb47 in forum Forms
    Replies: 2
    Last Post: 06-15-2011, 07:03 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