none
Unexpected datasheet data entry behavior RRS feed

  • Question

  • I'm using Access 2016 version 1907 (Build 11901.20176)

    I have a datasheet form bound to a query.  I open it in ReadOnly mode with the following code.
    Private Sub cbGen1_21_Click()
    DoCmd.OpenForm "f201_PAXFlightInfo_DS", acFormDS, , , acReadOnly, acWindowNormal

    End Sub

    When the form opens, data entry is not possible (as required).
    If a column gets filtered (also a required feature) data can then be changed. (problem)

    Am I missing something?  Is this a bug?



    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.


    • Edited by DriveEV Thursday, August 1, 2019 2:32 PM
    Thursday, August 1, 2019 2:26 PM

Answers

  • I found the culprit.

    Private Sub Form_Current()
    If Len(Me.tboPDNR) > 0 Then
    Me.AllowEdits = False
    Else
    Me.AllowEdits = True
    End If

    End Sub

    It seems that code overrides DoCmd.OpenForm "f201_PAXFlightInfo_DS", acFormDS, , , acReadOnly, acWindowNormal after filtering the datasheet.  Once removed the datasheet stays ReadOnly.


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.


    • Marked as answer by DriveEV Thursday, August 1, 2019 8:51 PM
    • Edited by DriveEV Thursday, August 1, 2019 8:56 PM
    Thursday, August 1, 2019 8:51 PM

All replies

  • Hi,

    Do you have any calculated fieds in your query? If yes please check whether if any record is resulting an error. If you fix that error calculation, this should work as I am also using the same version.

    Thanks,
    Mahmood
    Thursday, August 1, 2019 5:24 PM
  • I found the culprit.

    Private Sub Form_Current()
    If Len(Me.tboPDNR) > 0 Then
    Me.AllowEdits = False
    Else
    Me.AllowEdits = True
    End If

    End Sub

    It seems that code overrides DoCmd.OpenForm "f201_PAXFlightInfo_DS", acFormDS, , , acReadOnly, acWindowNormal after filtering the datasheet.  Once removed the datasheet stays ReadOnly.


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.


    • Marked as answer by DriveEV Thursday, August 1, 2019 8:51 PM
    • Edited by DriveEV Thursday, August 1, 2019 8:56 PM
    Thursday, August 1, 2019 8:51 PM