错误3141保留字或过程中的拼写错误

时间:2019-05-21 13:37:14

标签: ms-access access-vba

错误3141-尝试在访问中对VBA进行编码时保留字或拼写错误,请帮助

Private Sub textLotSequence2_LostFocus()
    ' If textLotSequence1 contains 4 valid (non "~") characters then populate label values.
'[Forms]![fschLabelInput].[comboBallGrade] & " '"
    On Error GoTo textLotSequence2_LostFocus_Error
    Dim strSql As String
    Dim x As Integer
    Dim dbs As Object
    Dim rst As DAO.Recordset
    Dim recCount As Integer
    Dim strTemp As String


    x = InStr(Me.textLotSequence2, "~")
    If x = 0 Then

            strSql = "SELECT [sch Data].[Ball Grade],[sch Data].[Ball Size], "
            strSql = strSql & " [sch Data].[Increment], "
            strSql = strSql & " [sch Data].[Part Number],"
            strSql = strSql & " FROM [sch Data] "
            strSql = strSql & " WHERE [Ball Grade] = '" & [Forms]![fschLabelInput].[comboBallGrade] & "'"
            strSql = strSql & " AND [Ball Size] = '" & [Forms]![fschLabelInput].[comboBallSize] & "'"
            strSql = strSql & " AND [Increment] = '" & [Forms]![fschLabelInput].[comboIncrement] & "'"

            Set dbs = Application.CurrentDb
            Set rst = dbs.OpenRecordset(strSql, dbOpenDynaset)
            recCount = rst.RecordCount
            If recCount = 0 Then
                MsgBox "The combination of Ball Grade, Size, and Increment is invalid. Please re-enter", vbCritical
                DoReset
                Exit Sub
            End If
            [Forms]![fschLabelInput].lblPartNumber.Caption = rst("Part Number")
            strTemp = makeDataMatrix
            rst.Close


        End If




    On Error GoTo 0
    Exit Sub

textLotSequence2_LostFocus_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure textLotSequence2_LostFocus of Sub Form_fschLabelInput"

End Sub

0 个答案:

没有答案