dungnvl08 > 19-06-14, 09:43 PM
Minh Tiên > 20-06-14, 11:57 AM
Private Sub Thucthi_Click()
Dim stt As Integer: stt = 0
Dim rst As Recordset
Dim db As Database
Set db = CurrentDb()
Set rst = db.OpenRecordset("table1") 'table1 có trường Sobaodanh
If Nz(Me.MaTruong, "") = "" Then
MsgBox "Chưa có mã trường !"
Me.MaTruong.SetFocus
Exit Sub
Else
If rst.RecordCount > 0 Then
rst.MoveFirst
Do Until rst.EOF
rst.Edit
stt = stt + 1
rst!Sobaodanh = Me.MaTruong & Format(stt, "0000")
rst.Update
rst.MoveNext
Loop
End If
End If
rst.Close
Set db=Nothing
End Sub
rst!Sobaodanh = Me.MaTruong & Format(stt, "0000")
rst!Sobaodanh=Me.MaTruong & rst!Sobaodanh
dungnvl08 > 20-06-14, 02:58 PM