Correct Quotes within Qoutes RRS feed

  • Question

  • Hi All, I've tried to figure this out on my own but just keep hitting a dead end. Hope someone could help me here.

    What is the correct Quote to use for a number in a string? I was using a text field to open a record for details and/or editing but needed to switch to the ID to keep it as a unique field but keep getting mismatch errors.

    This is what I was using for the text and it was working:

    Dim strWhere As String
        If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
                       'strWhere = "[Repair W/O] = """ & Me.[Repair W/O] & """"
                    DoCmd.OpenForm "Edit_Report_List_F", acViewNormal, , strWhere
                End If

    But need to use this one for the numbered unique field.

    Dim strWhere As Integer
        If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
                  strWhere = "[ID] = """ & Me.[ID] & """"
                  DoCmd.OpenReport "Validation_R", acViewReport, , strWhere
                End If

    The "ID" is the autonumber that is generated when the record is created.

    Would appreciate any help. Thanks.


    Monday, December 18, 2017 7:46 PM


  • Hi Dave,

    For numbers, you won't need to use any quote. Have you tried?

    strWhere = "[ID]=" & Me.[ID]

    Hope it helps...

    Monday, December 18, 2017 7:50 PM

All replies