blackie1982
Registered User.
- Local time
- Yesterday, 17:57
- Joined
- Jul 2, 2004
- Messages
- 18
Hi All,
I 'm having a problem with an sql statement. I need to select values from a table depending on the value in a textbox in a form. I keep getting a syntax error when I run the code. Here it is:
Dim sqlrecords As String
Dim tempRS As Integer
Dim tempString As String
Dim codeString As String
codeString = Forms![Calibration Record]!
I 'm having a problem with an sql statement. I need to select values from a table depending on the value in a textbox in a form. I keep getting a syntax error when I run the code. Here it is:
Dim sqlrecords As String
Dim tempRS As Integer
Dim tempString As String
Dim codeString As String
codeString = Forms![Calibration Record]!
Code:
sqlrecords = "SELECT COUNT (CalibrationRecord.Code) FROM CalibrationRecord WHERE Code = " & [Code]
Set DB2 = Application.CurrentDb
Set RSRecord2 = Nothing
Set RSRecord2 = DB2.OpenRecordSet(sqlrecords)
With RSRecord2
.MoveFirst
tempRS = RSRecord2.Fields(0)
.Close
End With
tempString = tempRS
Me.lblRecord.Caption = tempString + " Calibration Records"
'Me.lblRecord.Caption = codeString
Set RSRecord2 = Nothing
End Sub
Thank You