Results 1 to 2 of 2
  1. #1
    paloma.rz is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    3

    Unhappy Subform datasheet view bug - cant set to Read Only

    Hi guys!

    I have a Form with a subform in datasheet view, and a filter set with a combobox and a list. It all works ok until the user clicks on the datasheet, and then the first record on the table starts changing its data and it appears in other category, in particular the ones filtered. I dont know how to fix it, i tried setting it to read only on the subform, allow edits "no", locked it up, recordset type snapshot, SQL statements, nothing works. I went back on the code but nothing sounds strange enought to generate this error. Could anyone help me ? Thank you very much!!

    Code:

    Private Sub btnSearch_Click()
    Dim varItem As Variant
    Dim strSearch As String
    Dim strBO As String


    Me.DB_Milestone_Subform.Form.FilterOn = False


    For Each varItem In Me!ListCategoria.ItemsSelected
    strSearch = strSearch & "'" & Me!ListCategoria.ItemData(varItem) & "',"

    Next varItem


    If Len(strSearch) = 0 Then
    If IsNull(Me.cboBO) Then
    'do nothing
    Else
    strBO = Me.cboBO


    Me.DB_Milestone_Subform.Form.Filter = " [BO] = ( '" & strBO & "' )"
    Me.DB_Milestone_Subform.Form.FilterOn = True
    End If
    Else
    If IsNull(Me.cboBO) Then
    strSearch = Left(strSearch, Len(strSearch) - 1)
    Me.DB_Milestone_Subform.Form.Filter = " Categoria IN ( " & strSearch & " )"
    Me.DB_Milestone_Subform.Form.FilterOn = True
    Else
    strBO = Me.cboBO
    strSearch = Left(strSearch, Len(strSearch) - 1)
    Me.DB_Milestone_Subform.Form.Filter = " Categoria IN ( " & strSearch & " )AND [BO] = ( '" & strBO & "' )"
    Me.DB_Milestone_Subform.Form.FilterOn = True
    End If
    End If
    Me.GraphBO.Requery


    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Please post code between CODE tags to retain indentation and readability.

    Why would clicking on subform trigger code behind a button click event?

    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. Subform Datasheet View Sorting
    By Tina007 in forum Forms
    Replies: 3
    Last Post: 04-05-2015, 08:22 AM
  2. Replies: 4
    Last Post: 05-23-2014, 05:43 AM
  3. Replies: 3
    Last Post: 08-18-2013, 09:14 PM
  4. Replies: 6
    Last Post: 11-21-2012, 05:10 PM
  5. Subform, Totals, in Datasheet view
    By eww in forum Programming
    Replies: 1
    Last Post: 09-27-2010, 10:22 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