intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Đề tài tốt nghiệp: Thiết kế hệ truyền động hệ T-D

Chia sẻ: Tran Le Kim Yen Tran Le Kim Yen | Ngày: | Loại File: PDF | Số trang:44

61
lượt xem
9
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Chương 5 Thiết kế giao diện người máy 5.4 Các mã lệnh được sử dụng trong chương trình Private Sub Form_Load() DoCmd.Restore Dim db As DAO.Database

Chủ đề:
Lưu

Nội dung Text: Đề tài tốt nghiệp: Thiết kế hệ truyền động hệ T-D

  1. ĐỒ ÁN TỐT NGHIỆP QUẢN LÍ VẬT TƯ, THIẾT BỊ, ỨNG DỤNG PHÁT TRIỂN CHO TRUNG TÂM CNTT- ĐHQG TPHCM Chương 5 Thiết kế giao diện người máy 5.4 Các mã lệnh được sử dụng trong chương trình Private Sub Form_Load() DoCmd.Restore Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb() Set rs = db.OpenRecordset("user") If rs.EOF Then DoCmd.Close DoCmd.OpenForm "main"
  2. End If End Sub Private Sub login_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Me.dem = Me.dem + 1 Set db = CurrentDb() Set rs = db.OpenRecordset("user") rs.MoveFirst Do While Not rs.EOF If rs![username] = ten And rs![password] = ma Then kt = 1 Exit Do End If rs.MoveNext Loop If kt = 1 Then DoCmd.Close DoCmd.OpenForm "main" Else
  3. If Me.dem = 3 Then DoCmd.Quit Exit Sub End If MsgBox "ban nhap username hoac password sai", 0 + 48, "thong bao" End If End Sub Private Sub Form_Timer() Dim x As String, y As String Randomize r = Rnd(1) * 250 + 1 g = Rnd(1) * 250 + 1 b = Rnd(1) * 250 + 1 r1 = Rnd(1) * 250 + 1 g1 = Rnd(1) * 250 + 1 b1 = Rnd(1) * 250 + 1 Me.Label6.ForeColor = RGB(r, g, b) End Sub
  4. Option Compare Database Private Sub Form_Load() DoCmd.Restore End Sub Private Sub ok_Click() Dim db As DAO.Database, rec As DAO.Recordset Set db = CurrentDb() Set rec = db.OpenRecordset("admin") rec.MoveFirst If passcu = rec![pass] Then If IsNull(passmoi) And IsNull(xlpassmoi) Then MsgBox "Ban chua nhap ma so he thong moi!" & Chr(10) & "De nghi nhap day du", 0 + vbCritical, "Thong bao" Exit Sub End If If passmoi = xlpassmoi Then rec.Edit rec![pass] = passmoi rec.Update rec.Close db.Close
  5. passcu = "" passmoi = "" xlpassmoi = "" MsgBox "Ma so he thong da duoc thay doi", 0 + 64, "Thong bao" DoCmd.Close Else MsgBox "Xac lap ma so moi sai !" & Chr(10) & "De nghi nhap lai...", 0 + vbCritical, "Thong bao" passmoi = "" xlpassmoi = "" End If Else MsgBox "Ma he thong khong dung" & Chr(10) & "De nghi nhap lai", 0 + 16, "Thong bao" passcu = "" End If End Sub Option Compare Database Private Sub Command4_Click()
  6. Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb() Set rs = db.OpenRecordset("user") If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF If rs![userID] = mauser And rs![username] = ten And rs![password] = ma Then If IsNull(ma1) = False And IsNull(ma2) = False Then If ma1 = ma2 Then rs.Edit rs![password] = ma1 rs.Update MsgBox "Ban da thay doi ma so thanh cong", 0 + 60, "thong bao" Me.mauser = "" Me.ten = "" Me.ma = "" Me.ma1 = "" Me.ma2 = "" GoTo Thoat
  7. Else If ma1 ma2 Then MsgBox "new password va retype new password cua ban khong dung", 0 + 48, "thong bao" GoTo Thoat End If End If Else MsgBox "ban khong duoc de trong new password va retype new password", 0 + 48, "thong bao" GoTo Thoat End If End If rs.MoveNext Loop MsgBox "ban nhap userID, username hoac password chua dung", 0 + 60, "Thong bao" End If Thoat: End Sub
  8. Private Sub Form_Load() Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb() Set rs = db.OpenRecordset("user") If Not rs.EOF Then Me.ma.Enabled = True Me.ten.Enabled = True Else Me.ma.Enabled = False Me.ten.Enabled = False End If End Sub Private Sub Command13_Click() On Error GoTo Err_Command13_Click DoCmd.Close Exit_Command13_Click:
  9. Exit Sub Err_Command13_Click: MsgBox Err.Description Resume Exit_Command13_Click End Sub Private Sub Form_Load() DoCmd.Restore Me.khungxoa.Visible = False Me.khungthem.Visible = False End Sub Private Sub Ghi_Click() Dim db As DAO.Database Dim rec As DAO.Recordset Set db = CurrentDb() Set rec = db.OpenRecordset("user")
  10. If (mamoi "") And (ten "") And (pass "") Then On Error GoTo loi rec.AddNew rec![userID] = mamoi rec![username] = ten rec![password] = pass rec.Update mamoi = "" ten = "" pass = "" MsgBox "Ho so da duoc luu", 0 + 64, "Thong bao" Me.macu.Requery Me.bangma.Requery Else MsgBox "Nhap thieu du lieu", 0 + 64, "Thong bao" End If loi: rec.MoveFirst Do Until rec.EOF If rec![userID] = mamoi Then
  11. MsgBox "Ma User da ton tai" & Chr(10) & "De nghi nhap Ma User khac", 0 + 64, "thông báo" Exit Sub End If rec.MoveNext Loop End Sub Private Sub Option59_GotFocus() Me.khungxoa.Visible = False Me.khungthem.Visible = True End Sub Private Sub Option61_GotFocus() Me.khungxoa.Visible = True Me.khungthem.Visible = False End Sub Private Sub thoat1_Click() DoCmd.Close End Sub
  12. Private Sub thoat2_Click() DoCmd.Close End Sub Private Sub Xoa_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb() Set rs = db.OpenRecordset("user") rs.Edit Do While Not rs.EOF If rs![userID] = macu Then rs.Delete End If rs.MoveNext Loop Me.macu = "" bangma.Requery macu.Requery End Sub
  13. Option Compare Database Dim xMshh, xsl, Xthem, Xsua Private Sub Command13_Click() Select Case luachon Case 1: Me.List12.RowSource = "select * from nhacungcap where([nhacungcap]![mancc] like '*" & [txtma] & "*')" Case 2: Me.List12.RowSource = "select * from nhacungcap where([nhacungcap]![tenncc] like '*" & [txtten] & "*')" Case 3: Me.List12.RowSource = "select * from nhacungcap where([nhacungcap]![diachi] like '*" & [txtdiachi] & "*')" Case 4: Me.List12.RowSource = "select * from nhacungcap where([nhacungcap]![dienthoai] like '*" & [txtdienthoai] & "*')" End Select End Sub Private Sub Command49_Click() Me.txtma = "" Me.txtten = "" Me.txtdiachi = ""
  14. Me.txtdienthoai = "" Me.List12.RowSource = "select * from nhacungcap" End Sub Private Sub Cuoi_Click() On Error GoTo Err_Cuoi_Click If cmt = mancc Then MsgBox "ban dang o hang cuoi cung!", vbExclamation + vbDefaultButton1, "chu y" Else DoCmd.GoToRecord , , acLast End If Exit_Cuoi_Click: Exit Sub Err_Cuoi_Click: MsgBox Err.Description Resume Exit_Cuoi_Click End Sub Private Sub Form_Open(Cancel As Integer)
  15. DoCmd.Maximize End Sub Private Sub Dau_Click() On Error GoTo Err_Dau_Click If dmt = mancc Then MsgBox "ban dang o hang dau tien !", vbExclamation + vbDefaultButton1, "chu y" Else End If DoCmd.GoToRecord , , acFirst Exit_Dau_Click: Exit Sub Err_Dau_Click: MsgBox Err.Description Resume Exit_Dau_Click End Sub
  16. Private Sub Ghi_Click() On Error GoTo Err_Ghi_Click If IsNull(mancc) Then MsgBox "khong luu duoc gia tri rong!", vbExclamation + vbDefaultButton1, "chu y" Exit Sub Else DoCmd.RunCommand (acCmdSaveRecord) List12.Requery End If List12.Visible = True Dau.Visible = True Truoc.Visible = True Sau.Visible = True dieukien.Visible = True Cuoi.Visible = True Them.Visible = True Thoat.Visible = True DoCmd.GoToControl "Them" Ghi.Visible = False Khong.Visible = False Sua.Visible = True
  17. Xoa.Visible = True Xthem = False Xsua = False mancc.Locked = True tenncc.Locked = True diachi.Locked = True dienthoai.Locked = True sotk.Locked = True fax.Locked = True List12.Requery Exit_Ghi_Click: List12.Visible = True Dau.Visible = True dieukien.Visible = True Sau.Visible = True Truoc.Visible = True Cuoi.Visible = True Thoat.Visible = True Ghi.Visible = False Khong.Visible = False Xoa.Visible = True
  18. Sua.Visible = True Them.Visible = True DoCmd.GoToControl "Them" Xthem = False Xsua = False mancc.Locked = True tenncc.Locked = True diachi.Locked = True dienthoai.Locked = True sotk.Locked = True fax.Locked = True List12.Requery Exit Sub Err_Ghi_Click: MsgBox "Du lieu nhap khong hop le" End Sub Private Sub Khong_Click() On Error Resume Next DoCmd.RunCommand acCmdUndo
  19. DoCmd.GoToRecord , , acFirst List12.Visible = True Dau.Visible = True Sau.Visible = True dieukien.Visible = True Truoc.Visible = True Cuoi.Visible = True Thoat.Visible = True Sua.Visible = True Xoa.Visible = True Them.Visible = True Them.SetFocus Khong.Visible = False Ghi.Visible = False Xthem = False Xsua = False mancc.Locked = True tenncc.Locked = True diachi.Locked = True dienthoai.Locked = True sotk.Locked = True
  20. fax.Locked = True List12.Requery End Sub Private Sub Option35_GotFocus() Me.txtma.Enabled = True Me.txtten.Enabled = False Me.txtdiachi.Enabled = False Me.txtdienthoai.Enabled = False Me.txtma = "" Me.txtten = "" Me.txtdiachi = "" Me.txtdienthoai = "" End Sub Private Sub Option37_GotFocus() Me.txtma.Enabled = False Me.txtten.Enabled = True
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2