mrmintoa > 16-01-13, 06:31 PM
Private Sub cmdAddNewUnit_Click()
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim UnitSymbols As String
UnitSymbols = txtUnitSymbols
strSQL = "SELECT UnitSymbols FROM tbl_Unit WHERE UnitSymbols = '& UnitSymBols &'"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Dim Dem As Integer
Dem = 0
If rs.RecordCount <> 0 Then
rs.MoveFirst
While Not rs.EOF
Dem = Dem + 1
rs.MoveNext
Wend
MsgBox "So Rcs: " & Dem
ElseIf rs.RecordCount = 0 Then
MsgBox "Loi roi"
End If
mrmintoa > 17-01-13, 01:19 AM
Private Sub cmdAddNewUnit_Click()
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim dem As Integer
dem = 0
UnitSymbols = Me.txtUnitSymbols.Value
Set db = CurrentDb
strSQL = "SELECT * FROM tbl_Unit"
Set rs = db.OpenRecordset(strSQL)
rs.FindFirst ("UnitSymbols = '&UnitSymbols&'")
If Not rs.NoMatch Then
MsgBox "Da tim thay"
ElseIf rs.NoMatch Then
MsgBox "Bo tay roi"
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
mrmintoa > 17-01-13, 01:46 AM
hoanglonglangtu > 17-01-13, 09:25 AM