VERSION 5.00 Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX" Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX" Begin VB.Form reg_journal Caption = "โปรแกรมลงทะเบียนวารสาร" ClientHeight = 8490 ClientLeft = 60 ClientTop = 450 ClientWidth = 11880 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 8490 ScaleWidth = 11880 WindowState = 2 'Maximized Begin MSDataListLib.DataCombo DataCombo2 Height = 315 Left = 6000 TabIndex = 34 Top = 6600 Width = 2535 _ExtentX = 4471 _ExtentY = 556 _Version = 393216 Enabled = 0 'False ForeColor = 255 Text = "" BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.CommandButton Command7 BackColor = &H00FFFFC0& Caption = "บันทึก" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 Style = 1 'Graphical TabIndex = 9 Top = 6360 Width = 1575 End Begin VB.CommandButton Command6 BackColor = &H00C0E0FF& Caption = "ลบข้อมูล" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 MaskColor = &H00FFFFC0& Style = 1 'Graphical TabIndex = 28 Top = 5880 Width = 1575 End Begin VB.Frame Frame5 Caption = "ลงทะเบียนวารวาร" ForeColor = &H00C000C0& Height = 2775 Left = 840 TabIndex = 18 Top = 4440 Width = 7935 Begin MSComCtl2.MonthView MonthView1 Height = 2370 Left = 3000 TabIndex = 30 Top = 240 Visible = 0 'False Width = 2490 _ExtentX = 4392 _ExtentY = 4180 _Version = 393216 ForeColor = -2147483630 BackColor = -2147483633 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty StartOfWeek = 20840450 TitleBackColor = 16744576 CurrentDate = 37810 End Begin VB.CommandButton Command10 Caption = "..." Height = 255 Left = 3167 TabIndex = 8 Top = 2160 Width = 255 End Begin VB.CommandButton Command9 Caption = "..." Height = 255 Left = 3167 TabIndex = 4 Top = 720 Width = 255 End Begin VB.TextBox Text7 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 27 Top = 2160 Width = 1335 End Begin VB.TextBox Text6 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 7 Top = 1800 Width = 4695 End Begin VB.TextBox Text5 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 6 Top = 1440 Width = 1215 End Begin VB.TextBox Text4 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 5 Top = 1080 Width = 1215 End Begin VB.TextBox Text3 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 25 Top = 720 Width = 1335 End Begin VB.TextBox Text2 BackColor = &H00C0FFC0& Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1800 TabIndex = 24 Top = 360 Width = 1455 End Begin MSComCtl2.MonthView MonthView2 Height = 2370 Left = 3000 TabIndex = 31 Top = 240 Visible = 0 'False Width = 2490 _ExtentX = 4392 _ExtentY = 4180 _Version = 393216 ForeColor = -2147483630 BackColor = 16744576 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty StartOfWeek = 20840450 TitleBackColor = 16744576 TrailingForeColor= -2147483638 CurrentDate = 37810 End Begin VB.Label Label2 Alignment = 1 'Right Justify BackColor = &H80000004& Caption = "สถานที่จัดเก็บ :" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Index = 1 Left = 3840 TabIndex = 35 Top = 2160 Width = 1215 End Begin VB.Label Index_Label Caption = "NO" BeginProperty Font Name = "Tahoma" Size = 12 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000C0& Height = 255 Left = 5760 TabIndex = 33 Top = 720 Width = 495 End Begin VB.Label Label7 Caption = "INDEX :" BeginProperty Font Name = "Tahoma" Size = 12 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 255 Left = 4920 TabIndex = 32 Top = 720 Width = 975 End Begin VB.Label Label8 Alignment = 1 'Right Justify Caption = "วันที่รับ" ForeColor = &H00004000& Height = 255 Left = 960 TabIndex = 26 Top = 2160 Width = 615 End Begin VB.Label Label6 Alignment = 1 'Right Justify Caption = "คำอธิบาย" ForeColor = &H00004000& Height = 255 Left = 480 TabIndex = 23 Top = 1800 Width = 1095 End Begin VB.Label Label5 Alignment = 1 'Right Justify Caption = "ฉบับที่" ForeColor = &H00004000& Height = 255 Left = 600 TabIndex = 22 Top = 1440 Width = 975 End Begin VB.Label Label4 Alignment = 1 'Right Justify Caption = "ปี่ที่" ForeColor = &H00004000& Height = 255 Left = 600 TabIndex = 21 Top = 1080 Width = 975 End Begin VB.Label Label3 Alignment = 1 'Right Justify Caption = "ประจำเดือนที่" ForeColor = &H00004000& Height = 255 Left = 480 TabIndex = 20 Top = 720 Width = 1095 End Begin VB.Label Label2 Alignment = 1 'Right Justify Caption = "เลขะเบียน" ForeColor = &H00004000& Height = 255 Index = 0 Left = 720 TabIndex = 19 Top = 360 Width = 855 End End Begin VB.Frame Frame4 Caption = "ฉบับที่ได้รับ" ForeColor = &H00FF00FF& Height = 3615 Left = 5640 TabIndex = 15 Top = 840 Width = 6135 Begin MSFlexGridLib.MSFlexGrid show_item Height = 3255 Left = 120 TabIndex = 17 Top = 240 Width = 5895 _ExtentX = 10398 _ExtentY = 5741 _Version = 393216 Rows = 14 Cols = 7 FixedCols = 0 BackColor = 12648447 FocusRect = 0 HighLight = 2 SelectionMode = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End End Begin VB.Frame Frame3 Caption = "รายชื่อวารสาร" ForeColor = &H00FF00FF& Height = 3615 Left = 120 TabIndex = 14 Top = 840 Width = 5415 Begin MSFlexGridLib.MSFlexGrid show_journal Height = 3255 Left = 120 TabIndex = 16 Top = 240 Width = 5175 _ExtentX = 9128 _ExtentY = 5741 _Version = 393216 Rows = 14 Cols = 4 FixedCols = 0 BackColor = 16777152 FocusRect = 0 HighLight = 2 SelectionMode = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End End Begin VB.CommandButton Command5 BackColor = &H00FFC0C0& Caption = "Exit" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 MaskColor = &H00FFFFC0& Style = 1 'Graphical TabIndex = 13 Top = 7320 Width = 1575 End Begin VB.CommandButton Command4 BackColor = &H00FFFFC0& Caption = "ยกเลิก" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 MaskColor = &H00FFFFC0& Style = 1 'Graphical TabIndex = 10 Top = 6840 Width = 1575 End Begin VB.CommandButton Command3 BackColor = &H00C0E0FF& Caption = "แก้ไข" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 MaskColor = &H00FFFFC0& Style = 1 'Graphical TabIndex = 12 Top = 5400 Width = 1575 End Begin VB.CommandButton Command2 BackColor = &H00C0E0FF& Caption = "ลงทะเบียนใหม่" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 10080 MaskColor = &H00FFFFC0& Style = 1 'Graphical TabIndex = 11 Top = 4920 Width = 1575 End Begin VB.Frame Frame2 Caption = "เล่มล่าสุดที่ลงทะเบียน" ForeColor = &H00C000C0& Height = 615 Left = 840 TabIndex = 3 Top = 7200 Width = 7935 Begin VB.Label Label1 BackColor = &H00C0E0FF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 255 Left = 360 TabIndex = 36 Top = 240 Width = 7095 End End Begin VB.Frame Frame1 Caption = "ป้อนรายชื่อวารสาร" ForeColor = &H00FF00FF& Height = 735 Left = 360 TabIndex = 0 Top = 120 Width = 11175 Begin VB.CommandButton Command8 Caption = "Clear" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 9120 TabIndex = 29 Top = 240 Width = 1695 End Begin VB.CommandButton Command1 Caption = "Search" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 7320 TabIndex = 2 Top = 240 Width = 1695 End Begin VB.TextBox Text1 BackColor = &H00C0FFC0& BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 720 TabIndex = 1 Top = 240 Width = 6135 End End End Attribute VB_Name = "reg_journal" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim Conn As New ADODB.Connection Dim magazinetb As New ADODB.Recordset Dim list_itemtb As New ADODB.Recordset Dim ck_index As New ADODB.Recordset Dim jourctrltb As New ADODB.Recordset Dim locate As New ADODB.Recordset Dim sta_buttom As String Dim m_pointer As String Private Sub Command1_Click() Dim line_showj As Integer line_showj = 1 If Trim(Text1.Text) <> "" Then With magazinetb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select magazine.pointer,magazine.Magazine_Name,magazine.department_code,department.department_thai_des from magazine,department Where magazine.Magazine_Name LIKE '%" & Text1.Text & "%' and magazine.department_code=department.department_code" If Not .EOF Then With show_journal .Rows = magazinetb.RecordCount + 1 magazinetb.MoveFirst Do While Not magazinetb.EOF .TextMatrix(line_showj, 0) = magazinetb.Fields(1).Value .TextMatrix(line_showj, 1) = magazinetb.Fields(3).Value .TextMatrix(line_showj, 2) = magazinetb.Fields(0).Value .TextMatrix(line_showj, 3) = magazinetb.Fields(2).Value line_showj = line_showj + 1 magazinetb.MoveNext Loop End With show_journal.SetFocus Else MsgBox "ไม่พบรายชื่อวารสารนี้", vbCritical + vbOKOnly, "ไม่พบข้อมูล" Text1.Text = "" Text1.SetFocus End If .Close End With Else MsgBox "กรุณาพิมพ์รายชื่อวารสารที่ต้องการลงทะเบียน", vbCritical + vbOKOnly, "ข้อผิดพลาด" Text1.SetFocus End If End Sub Private Sub Command10_Click() MonthView2.Visible = True MonthView2.Value = Now End Sub Private Sub Command2_Click() Text2 = "" Text3 = "" Text4 = "" Text5 = "" Text6 = "" Text7 = "" DataCombo2.Text = "" Call active_textbox sta_buttom = "New" show_item.Enabled = False show_journal.Enabled = False Command4.Enabled = True Command7.Enabled = True Command2.Enabled = False Command3.Enabled = False Command6.Enabled = False Text7.Text = Format(Now, "dd/mm/yyyy") With jourctrltb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from jourctrl" Text2.Text = .Fields(0).Value .Close End With Command9.SetFocus End Sub Private Sub Command3_Click() Call active_textbox sta_buttom = "Edit" show_item.Enabled = False show_journal.Enabled = False Command4.Enabled = True Command7.Enabled = True Command2.Enabled = False Command3.Enabled = False Command6.Enabled = False Command9.SetFocus End Sub Private Sub Command4_Click() Call reset_textbox show_item.Enabled = True show_journal.Enabled = True Command4.Enabled = False Command7.Enabled = False Command2.Enabled = True Command3.Enabled = True Command6.Enabled = True End Sub Private Sub Command5_Click() Unload Me End Sub Private Sub Command6_Click() Dim line_item As Integer If MsgBox("ต้องการลบข้อมูลวารสารเลขทะเบียนนี้หรือไม่", vbQuestion + vbOKCancel, " ยืนยันการลบข้อมูล") = vbOK Then With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .LockType = adLockOptimistic .Open "select * from tranfile Where magno='" & Trim(Text2.Text) & "'" If Not .EOF Then .Delete .Update MsgBox "ทำการลบข้อมูลเรียบร้อยแล้ว", vbInformation + vbOKOnly, "ผลการลบข้อมูล" Text2 = "" Text3 = "" Text4 = "" Text5 = "" Text6 = "" Text7 = "" DataCombo2.Text = "" Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False DataCombo2.Enabled = False End If .Close End With With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from tranfile Where trim(pointer)='" & show_journal.TextMatrix(show_journal.Row, 2) & "' order by daily desc" If Not .EOF Then With show_item .Rows = list_itemtb.RecordCount + 1 list_itemtb.MoveFirst line_item = 1 Do While Not list_itemtb.EOF .TextMatrix(line_item, 0) = list_itemtb.Fields(0).Value .TextMatrix(line_item, 1) = Format(list_itemtb.Fields(3).Value, "dd/mm/yyyy") .TextMatrix(line_item, 2) = list_itemtb.Fields(4).Value .TextMatrix(line_item, 3) = list_itemtb.Fields(5).Value .ColAlignment(4) = 0 .TextMatrix(line_item, 4) = list_itemtb.Fields(6).Value .TextMatrix(line_item, 5) = Format(list_itemtb.Fields(2).Value, "dd/mm/yyyy") line_item = line_item + 1 list_itemtb.MoveNext Loop Label1.Caption = " Magno= " & .TextMatrix(1, 0) & " Daily= " & .TextMatrix(1, 1) & " : " & .TextMatrix(1, 4) show_journal.HighLight = flexHighlightAlways show_item.HighLight = flexHighlightWithFocus End With Command2.Enabled = True End If .Close End With End If End Sub Private Sub Command7_Click() Dim line_item As Integer If MsgBox("ต้องการบันทึกข้อมูลวารสารเลขทะเบียนนี้หรือไม่", vbQuestion + vbOKCancel, " ยืนยันการบันทึกข้อมูล") = vbOK Then show_item.Enabled = True show_journal.Enabled = True Select Case sta_buttom Case "New" With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .LockType = adLockOptimistic .Open "select * from tranfile " .AddNew .Fields(0).Value = Text2.Text .Fields(1).Value = show_journal.TextMatrix(show_journal.Row, 2) .Fields(2).Value = Text7.Text .Fields(3).Value = Text3.Text .Fields(4).Value = Text4.Text .Fields(5).Value = Text5.Text .Fields(6).Value = Text6.Text .Fields(8).Value = "O" .Fields(17).Value = Trim(DataCombo2.BoundText) .Update .Close End With With jourctrltb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .LockType = adLockOptimistic .Open "select * from jourctrl" .Fields(0).Value = Trim(Str(Val(Text2.Text) + 1)) .Update .Close End With MsgBox "บันทึกข้อมูลลงทะเบียนวารสารเรียบร้อยแล้ว", vbInformation + vbOKOnly, "ผลการบันทึก" With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from tranfile Where trim(pointer)='" & show_journal.TextMatrix(show_journal.Row, 2) & "' order by daily desc" If Not .EOF Then With show_item .Rows = list_itemtb.RecordCount + 1 list_itemtb.MoveFirst line_item = 1 Do While Not list_itemtb.EOF .TextMatrix(line_item, 0) = list_itemtb.Fields(0).Value .TextMatrix(line_item, 1) = Format(list_itemtb.Fields(3).Value, "dd/mm/yyyy") If list_itemtb.Fields(4).Value <> "" Then .TextMatrix(line_item, 2) = list_itemtb.Fields(4).Value If list_itemtb.Fields(5).Value <> "" Then .TextMatrix(line_item, 3) = list_itemtb.Fields(5).Value .ColAlignment(4) = 0 If list_itemtb.Fields(6).Value <> "" Then .TextMatrix(line_item, 4) = list_itemtb.Fields(6).Value .TextMatrix(line_item, 5) = Format(list_itemtb.Fields(2).Value, "dd/mm/yyyy") line_item = line_item + 1 list_itemtb.MoveNext Loop Label1.Caption = " Magno= " & .TextMatrix(1, 0) & " Daily= " & .TextMatrix(1, 1) & " : " & .TextMatrix(1, 4) show_journal.HighLight = flexHighlightAlways show_item.HighLight = flexHighlightWithFocus End With Text2 = "" Text3 = "" Text4 = "" Text5 = "" Text6 = "" Text7 = "" Command2.Enabled = True End If .Close End With Case "Edit" With list_itemtb If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from tranfile Where trim(magno)='" & Trim(Text2.Text) & "'", Conn, adOpenDynamic, adLockOptimistic If Not .EOF Then .Fields(3).Value = Text3.Text .Fields(4).Value = Text4.Text .Fields(5).Value = Text5.Text .Fields(6).Value = Text6.Text .Fields(2).Value = Text7.Text .Fields(17).Value = Trim(DataCombo2.BoundText) .Update MsgBox "บันทึกข้อมูลที่ทำการแก้ไขแล้ว", vbInformation + vbOKOnly, "ผลการบันทึก" End If .Close End With With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from tranfile Where trim(pointer)='" & show_journal.TextMatrix(show_journal.Row, 2) & "' order by daily desc" If Not .EOF Then With show_item .Rows = list_itemtb.RecordCount + 1 list_itemtb.MoveFirst line_item = 1 Do While Not list_itemtb.EOF .TextMatrix(line_item, 0) = list_itemtb.Fields(0).Value .TextMatrix(line_item, 1) = Format(list_itemtb.Fields(3).Value, "dd/mm/yyyy") If list_itemtb.Fields(4).Value <> "" Then .TextMatrix(line_item, 2) = list_itemtb.Fields(4).Value If list_itemtb.Fields(5).Value <> "" Then .TextMatrix(line_item, 3) = list_itemtb.Fields(5).Value .ColAlignment(4) = 0 If list_itemtb.Fields(6).Value <> "" Then .TextMatrix(line_item, 4) = list_itemtb.Fields(6).Value .TextMatrix(line_item, 5) = Format(list_itemtb.Fields(2).Value, "dd/mm/yyyy") line_item = line_item + 1 list_itemtb.MoveNext Loop Label1.Caption = " Magno= " & .TextMatrix(1, 0) & " Daily= " & .TextMatrix(1, 1) & " : " & .TextMatrix(1, 4) show_journal.HighLight = flexHighlightAlways show_item.HighLight = flexHighlightWithFocus End With Command2.Enabled = True End If .Close End With End Select Call reset_textbox show_item.Enabled = True show_journal.Enabled = True Command4.Enabled = False Command7.Enabled = False Command2.Enabled = True Command3.Enabled = True Command6.Enabled = True End If End Sub Private Sub Command8_Click() show_journal.HighLight = flexHighlightWithFocus show_item.HighLight = flexHighlightWithFocus Text2 = "" Text3 = "" Text4 = "" Text5 = "" Text6 = "" Text7 = "" Label1.Caption = "" Index_Label.Caption = "NO" Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False Call cls_show_listitem Call cls_show_journal Command2.Enabled = False Command3.Enabled = False Command6.Enabled = False Text1 = "" Text1.SetFocus End Sub Private Sub Command9_Click() MonthView1.Visible = True MonthView1.Value = Now End Sub Private Sub Form_Load() With show_journal .ColWidth(0) = 3500 .ColWidth(1) = 6000 .TextMatrix(0, 0) = "ชื่อวาสาร" .TextMatrix(0, 1) = "คณะที่บอกรับ" End With With show_item .ColWidth(0) = 950 .ColWidth(1) = 1200 .ColWidth(2) = 600 .ColWidth(3) = 700 .ColWidth(4) = 5000 .ColWidth(5) = 2500 .ColWidth(6) = 1500 .TextMatrix(0, 0) = "เลขทะเบียน" .TextMatrix(0, 1) = "ประจำเดือน" .TextMatrix(0, 2) = "ปีที่" .TextMatrix(0, 3) = "เล่มที่" .TextMatrix(0, 4) = "คำอธิบาย" .TextMatrix(0, 5) = "วันที่รับ" .TextMatrix(0, 6) = "สถานที่จัดเก็บ" End With Set Conn = New ADODB.Connection Conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _ & "SERVER=192.168.1.15;" _ & "DATABASE=magazine;" _ & "UID=chaiya;" _ & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384 Conn.CursorLocation = adUseClient Conn.Mode = adModeUnknown Conn.Open Set locate = New ADODB.Recordset With locate If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "Select * From location", Conn, adOpenForwardOnly, adLockReadOnly End With Set DataCombo2.RowSource = locate DataCombo2.ListField = "locate_type" DataCombo2.BoundColumn = "locate_id" End Sub Private Sub MonthView1_DateClick(ByVal DateClicked As Date) Text3.Text = Format(DateClicked, "dd/mm/yyyy") MonthView1.Visible = False End Sub Private Sub MonthView2_DateClick(ByVal DateClicked As Date) Text7.Text = Format(DateClicked, "dd/mm/yyyy") MonthView2.Visible = False End Sub Private Sub show_item_Click() With show_item Text2.Text = .TextMatrix(.Row, 0) Text3.Text = .TextMatrix(.Row, 1) Text4.Text = .TextMatrix(.Row, 2) Text5.Text = .TextMatrix(.Row, 3) Text6.Text = .TextMatrix(.Row, 4) Text7.Text = .TextMatrix(.Row, 5) DataCombo2.Text = .TextMatrix(.Row, 6) End With 'check index With ck_index If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from article Where trim(pointer)='" & m_pointer & "' and trim(year)='" & show_item.TextMatrix(show_item.Row, 2) & "' and trim(volume)='" & show_item.TextMatrix(show_item.Row, 3) & "'" If Not .EOF Then Index_Label.Caption = "YES" Else Index_Label.Caption = "NO" End If .Close End With show_item.HighLight = flexHighlightAlways Command3.Enabled = True Command6.Enabled = True End Sub Private Sub show_journal_Click() Dim line_item As Integer Dim mem_magno As String line_item = 1 Call cls_show_listitem Call reset_textbox m_pointer = Trim(show_journal.TextMatrix(show_journal.Row, 2)) With list_itemtb If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from tranfile Where trim(pointer)='" & m_pointer & "' order by daily desc" If Not .EOF Then With show_item .Rows = list_itemtb.RecordCount + 1 list_itemtb.MoveFirst Do While Not list_itemtb.EOF .TextMatrix(line_item, 0) = list_itemtb.Fields(0).Value .TextMatrix(line_item, 1) = Format(list_itemtb.Fields(3).Value, "dd/mm/yyyy") If list_itemtb.Fields(17).Value = "1" Then .TextMatrix(line_item, 6) = "ศูนย์วิทยบริการและหอสมุด" If list_itemtb.Fields(17).Value = "2" Then .TextMatrix(line_item, 6) = "ศูนย์สยามคอมเพล็กซ์" If list_itemtb.Fields(4).Value <> "" Then .TextMatrix(line_item, 2) = list_itemtb.Fields(4).Value If list_itemtb.Fields(5).Value <> "" Then .TextMatrix(line_item, 3) = list_itemtb.Fields(5).Value .ColAlignment(4) = 0 If list_itemtb.Fields(6).Value <> "" Then .TextMatrix(line_item, 4) = list_itemtb.Fields(6).Value .TextMatrix(line_item, 5) = Format(list_itemtb.Fields(2).Value, "dd/mm/yyyy") line_item = line_item + 1 list_itemtb.MoveNext Loop Label1.Caption = " Magno= " & .TextMatrix(1, 0) & " Daily= " & .TextMatrix(1, 1) & " : " & .TextMatrix(1, 4) show_journal.HighLight = flexHighlightAlways show_item.HighLight = flexHighlightWithFocus End With 'check index With ck_index If .State = adStateOpen Then .Close .ActiveConnection = Conn .CursorType = adOpenForwardOnly .CursorLocation = adUseClient .Open "select * from article Where trim(pointer)='" & m_pointer & "' and trim(year)='" & show_item.TextMatrix(1, 2) & "' and trim(volume)='" & show_item.TextMatrix(1, 3) & "'" If Not .EOF Then Index_Label.Caption = "YES" Else Index_Label.Caption = "NO" End If .Close End With Command2.Enabled = True Else Label1.Caption = "" MsgBox "รายชื่อวารสารนี้ไม่พบข้อมูลการลงทะเบียน", vbCritical + vbOKOnly, "ไม่พบวารสารที่ลงทะเบียน" Command2.Enabled = True End If .Close End With End Sub Sub active_textbox() Text4.Enabled = True Text5.Enabled = True Text6.Enabled = True DataCombo2.Enabled = True End Sub Sub reset_textbox() Text2 = "" Text3 = "" Text4 = "" Text5 = "" Text6 = "" Text7 = "" DataCombo2.Text = "" With show_item Text2.Text = .TextMatrix(.Row, 0) Text3.Text = .TextMatrix(.Row, 1) Text4.Text = .TextMatrix(.Row, 2) Text5.Text = .TextMatrix(.Row, 3) Text6.Text = .TextMatrix(.Row, 4) Text7.Text = .TextMatrix(.Row, 5) End With Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False DataCombo2.Enabled = False End Sub Sub cls_show_journal() Dim i As Integer With show_journal .Rows = 14 For i = 1 To 13 .TextMatrix(i, 0) = "" .TextMatrix(i, 1) = "" Next i End With End Sub Sub cls_show_listitem() Dim i As Integer With show_item .Rows = 14 For i = 1 To 13 .TextMatrix(i, 0) = "" .TextMatrix(i, 1) = "" .TextMatrix(i, 2) = "" .TextMatrix(i, 3) = "" .TextMatrix(i, 4) = "" .TextMatrix(i, 5) = "" .TextMatrix(i, 6) = "" Next i End With End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Command1_Click End If End Sub