the Select statement includes a reserved word or an argument name that is misspelled or missing..
basically I want if Ball Grade ,Ball Size & Increment match sch Data table then show partcode
Please help I am a novice at access VBA
Thanks in advance
basically I want if Ball Grade ,Ball Size & Increment match sch Data table then show partcode
Please help I am a novice at access VBA
Code:
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
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.CurrentProject
Set rst = dbs.OpenRecordset(strSql, dbOpenDynaset)
[Forms]![fschLabelInput].lblPartNumber.Caption = rst("Part Number")
rst.Close
txtBarcode = Mid(lblBarcode.Caption, 2, 12)
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
Thanks in advance