Form dạng thuốc

Một phần của tài liệu LUẬN VĂN:Quản lý việc bán thuốc cho cửa hàng tân dược potx (Trang 58 - 63)

Khi cửa hàng nhận thuốc từ nhà cung cấp về, phân loại và nhập mã dạng thuốc cho dạng thuốc đó nếu dạng thuốc đó chưa có trong danh mục dạng thuốc, nếu dạng thuốc đó đã co trong danh mục dạng thuốc thì chương trính sẽ thông báo đã có dạng thuốc này

Private Sub cmddong_Click() Unload frmdangthuoc

End Sub

Private Sub cmdsua_Click() Adodt.Recordset.Update End Sub

Private Sub cmdthem_Click() txtma.SetFocus

Adodt.Recordset.AddNew End Sub

Private Sub cmdxoa_Click()

If (MsgBox("Bạn có muốn xoá bản ghi này không", 36, "Cửa số xoá dữ liệu") = vbYes) Then

Adodt.Recordset.Delete

If (Adodt.Recordset.EOF = False) Then Adodt.Recordset.MoveNext

Else

MsgBox "bạn đã xoá hết các trường" End If

End If End Sub

Private Sub Command1_Click() If Adodt.Recordset.EOF Then MsgBox "bạn đã ở bản ghi cuối" Else

Adodt.Recordset.MoveFirst End If

End Sub

Private Sub Command2_Click(Index As Integer) If Adodt.Recordset.BOF Then

MsgBox "bạn đã ở cuối file ! " Else

Adodt.Recordset.MovePrevious End If

End Sub

Private Sub Command3_Click(Index As Integer) If Adodt.Recordset.EOF Then

MsgBox "bạn đã chọn đầu file" Else

Adodt.Recordset.MoveNext End If

End Sub

Private Sub Command4_Click(Index As Integer) Adodt.Recordset.MoveLast

End Sub

4.3.Form loại thuốc

Cũng tương tự như dạng thuốc ta cũng phải phân loại cho loại thuốc đó bằng cách nhập mã loại thuốc, tên loại ,và chọn mã dạng thuốc trong hộp combo để chon Nếu không biết mã dạng thuốc thì người quản lý có thể chọn nút lệnh “dạng thuốc” khi đó chương trình sẽ chạy form dạng thuốc từ đó ta có thể biết được mã dạng thuốc cho loại thuốc đó (adsbygoogle = window.adsbygoogle || []).push({});

Mã chương trình loại thuốc Private Sub cmđangt_Click() frmdangthuoc.Show

End Sub

Private Sub cmddong_Click() Unload frmloaithuoc

End Sub

Private Sub cmdsua_Click() Adodt.Recordset.Edit

End Sub

Private Sub cmdthem_Click() txtma.Enabled = True

txtten.Enabled = True Data1.Recordset.AddNew End Sub

Private Sub cmdtim_Click() cmdtim.Enabled = True Data1.Recordset.Edit End Sub

Private Sub cmdxoa_Click()

If (MsgBox("Bạn có muốn xoá bản ghi này không", 36, "Cửa số xoá dữ liệu") = vbYes) Then

Data1.Recordset.Delete Data1.Recordset.MoveNext End If

End Sub

Private Sub Command1_Click() Data1.Recordset.MoveFirst End Sub

Private Sub Command4_Click() Data1.Recordset.MoveLast End Sub

Private Sub Command3_Click() Data1.Recordset.MoveNext End Sub

Private Sub Command2_Click() Data1.Recordset.MovePrevious End Sub

Private Sub DataGrid1_Click() DataGrid1.AllowAddNew = False

DataGrid1.AllowUpdate = False End Sub

Private Sub DBCombo1_Change() Dim rs As Recordset

Dim db As Database Dim str As String

If DBCombo1.Text <> "" Then

Set db = OpenDatabase(Data1.DatabaseName)

str = "select* from dthuoc where madthuoc=" + """" + DBCombo1.Text + """" Set rs = db.OpenRecordset(str) Lbldt.Caption = rs.Fields("tendthuoc") rs.Close db.Close End If End Sub

Private Sub Form_Load() txtma.Enabled = False txtten.Enabled = False End Sub

Một phần của tài liệu LUẬN VĂN:Quản lý việc bán thuốc cho cửa hàng tân dược potx (Trang 58 - 63)