VERSION 5.00 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 edit_index_journal Caption = "โปรแกรมแก้ไขดรรชนีวารสาร" ClientHeight = 8490 ClientLeft = 60 ClientTop = 450 ClientWidth = 11880 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 8490 ScaleWidth = 11880 WindowState = 2 'Maximized Begin VB.CommandButton Cmddel BackColor = &H00C0E0FF& Caption = "Delete" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":0000 Style = 1 'Graphical TabIndex = 55 Top = 4800 Width = 1335 End Begin VB.Frame Frame4 Caption = "บทคัดย่อ ( Abstract )" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000080& Height = 5535 Left = 2160 TabIndex = 52 Top = 2640 Visible = 0 'False Width = 7935 Begin VB.CommandButton Command4 BackColor = &H00FFC0C0& Caption = "Close" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 5880 Style = 1 'Graphical TabIndex = 54 Top = 4920 Width = 1575 End Begin VB.TextBox Text5 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00800000& Height = 4335 Left = 360 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 53 Top = 480 Width = 7215 End End Begin MSDataListLib.DataList List_Index Height = 1980 Left = 2160 TabIndex = 50 Top = 480 Visible = 0 'False Width = 7095 _ExtentX = 12515 _ExtentY = 3493 _Version = 393216 BackColor = 12640511 ForeColor = 8388608 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.CommandButton Cmdprev BackColor = &H00C0FFC0& Caption = "Previous" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":030A Style = 1 'Graphical TabIndex = 49 Top = 1560 Width = 1335 End Begin VB.CommandButton Cmdnext BackColor = &H00C0FFC0& Caption = "Next" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":074C Style = 1 'Graphical TabIndex = 48 Top = 600 Width = 1335 End Begin VB.CommandButton Cmdedit BackColor = &H00FFC0FF& Caption = "Edit" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":0B8E Style = 1 'Graphical TabIndex = 47 Top = 3840 Width = 1335 End Begin VB.CommandButton Cmdsave BackColor = &H00FFFFC0& Caption = "Save" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":0E98 Style = 1 'Graphical TabIndex = 14 Top = 3840 Width = 1335 End Begin VB.CommandButton Cmdcancel BackColor = &H00FFFFC0& Caption = "Cancel" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":11A2 Style = 1 'Graphical TabIndex = 15 Top = 5760 Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H00FFFFC0& Caption = "Exit" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 10320 Picture = "edit_index_journal.frx":14AC Style = 1 'Graphical TabIndex = 16 Top = 6720 Width = 1335 End Begin MSDataListLib.DataList List_authname Height = 1260 Left = 2880 TabIndex = 39 Top = 1200 Visible = 0 'False Width = 5775 _ExtentX = 10186 _ExtentY = 2223 _Version = 393216 BackColor = 12632319 ForeColor = 8388608 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.Frame Frame2 Caption = "ผู้แต่ง" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000C0& Height = 1485 Left = 2160 TabIndex = 40 Top = 1080 Width = 5415 Begin VB.TextBox Text4 Height = 375 Index = 2 Left = 4920 TabIndex = 46 Text = "Text4" Top = 960 Visible = 0 'False Width = 495 End Begin VB.TextBox Text4 Height = 375 Index = 1 Left = 4920 TabIndex = 45 Text = "Text4" Top = 600 Visible = 0 'False Width = 495 End Begin VB.TextBox Text3 BackColor = &H00FFFFC0& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 405 Index = 0 Left = 720 TabIndex = 2 Top = 225 Width = 3975 End Begin VB.TextBox Text3 BackColor = &H00FFFFC0& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 405 Index = 1 Left = 720 TabIndex = 3 Top = 610 Width = 3975 End Begin VB.TextBox Text3 BackColor = &H00FFFFC0& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 405 Index = 2 Left = 720 TabIndex = 4 Top = 1000 Width = 3975 End Begin VB.TextBox Text4 Height = 375 Index = 0 Left = 4920 TabIndex = 41 Text = "Text4" Top = 240 Visible = 0 'False Width = 495 End Begin VB.Label Label3 Caption = "1." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 44 Top = 240 Width = 255 End Begin VB.Label Label12 Caption = "2." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 43 Top = 615 Width = 255 End Begin VB.Label Label13 Caption = "3." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 42 Top = 975 Width = 255 End End Begin MSFlexGridLib.MSFlexGrid show_item Height = 2775 Left = 3720 TabIndex = 37 Top = 5040 Visible = 0 'False Width = 5895 _ExtentX = 10398 _ExtentY = 4895 _Version = 393216 Rows = 14 Cols = 6 FixedCols = 0 BackColor = 16777152 FocusRect = 0 HighLight = 2 SelectionMode = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin MSDataListLib.DataList dlbnamemag Height = 1740 Left = 3720 TabIndex = 36 Top = 5040 Visible = 0 'False Width = 6615 _ExtentX = 11668 _ExtentY = 3069 _Version = 393216 BackColor = 12648384 ForeColor = 8388608 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.TextBox Text2 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 600 Left = 2160 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 1 Top = 480 Width = 7215 End Begin VB.TextBox Text1 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00004080& Height = 375 Left = 2160 TabIndex = 28 Top = 120 Width = 1455 End Begin VB.Frame Frame3 Caption = "ชื่อหัวเรื่อง" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000C0& Height = 2295 Left = 2160 TabIndex = 22 Top = 2550 Width = 7215 Begin MSDataListLib.DataList list_subject Height = 1740 Left = 720 TabIndex = 38 Top = 240 Visible = 0 'False Width = 5775 _ExtentX = 10186 _ExtentY = 3069 _Version = 393216 BackColor = 12648447 ForeColor = 12582912 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.TextBox Text6 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 = &H00800000& Height = 375 Index = 4 Left = 720 TabIndex = 9 Top = 1680 Width = 5775 End Begin VB.TextBox Text6 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 = &H00800000& Height = 375 Index = 3 Left = 720 TabIndex = 8 Top = 1320 Width = 5775 End Begin VB.TextBox Text6 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 = &H00800000& Height = 375 Index = 2 Left = 720 TabIndex = 7 Top = 960 Width = 5775 End Begin VB.TextBox Text6 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 = &H00800000& Height = 375 Index = 1 Left = 720 TabIndex = 6 Top = 600 Width = 5775 End Begin VB.TextBox Text6 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 = &H00800000& Height = 375 Index = 0 Left = 720 TabIndex = 5 Top = 240 Width = 5775 End Begin VB.Label Label18 Caption = "5." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 27 Top = 1730 Width = 255 End Begin VB.Label Label17 Caption = "4." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 26 Top = 1370 Width = 255 End Begin VB.Label Label16 Caption = "3." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 25 Top = 990 Width = 255 End Begin VB.Label Label15 Caption = "2." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 24 Top = 610 Width = 255 End Begin VB.Label Label14 Caption = "1." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 255 Left = 480 TabIndex = 23 Top = 240 Width = 255 End End Begin VB.Frame Frame1 Caption = "รายละเอียด" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000C0& Height = 3375 Left = 2160 TabIndex = 18 Top = 4800 Width = 7215 Begin VB.CommandButton Command3 BackColor = &H00C0FFC0& Caption = "Abstract" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 1560 Style = 1 'Graphical TabIndex = 51 Top = 2760 Width = 1815 End Begin VB.TextBox Text13 Height = 285 Left = 3960 TabIndex = 35 Top = 960 Visible = 0 'False Width = 1455 End Begin VB.CommandButton Command1 BackColor = &H00FFC0C0& 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 = 375 Left = 2400 Style = 1 'Graphical TabIndex = 11 Top = 880 Width = 1215 End Begin VB.TextBox Text12 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 615 Left = 1560 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 13 Top = 2050 Width = 5415 End Begin VB.TextBox Text11 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 375 Left = 1560 TabIndex = 12 Top = 1680 Width = 1695 End Begin VB.TextBox Text10 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 375 Left = 3240 Locked = -1 'True TabIndex = 34 Top = 1270 Width = 3735 End Begin VB.TextBox Text9 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 375 Left = 1560 Locked = -1 'True TabIndex = 33 Top = 1270 Width = 975 End Begin VB.TextBox Text8 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 375 Left = 1560 Locked = -1 'True TabIndex = 32 Top = 880 Width = 735 End Begin VB.TextBox Text7 BackColor = &H00C0FFFF& BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 615 Left = 1560 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 10 Top = 240 Width = 5415 End Begin VB.Label Label11 Caption = "หมายเหตุ" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 720 TabIndex = 31 Top = 2050 Width = 855 End Begin VB.Label Label6 Caption = "ชื่อวารสาร" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 600 TabIndex = 30 Top = 240 Width = 855 End Begin VB.Label Label10 Alignment = 1 'Right Justify Caption = "เลขหน้า" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 720 TabIndex = 29 Top = 1680 Width = 735 End Begin VB.Label Label9 Alignment = 1 'Right Justify Caption = "เดือน" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 2640 TabIndex = 21 Top = 1270 Width = 495 End Begin VB.Label Label8 Alignment = 1 'Right Justify Caption = "ฉบับที่" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 960 TabIndex = 20 Top = 1270 Width = 495 End Begin VB.Label Label7 Alignment = 1 'Right Justify Caption = "ปีที่" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 1080 TabIndex = 19 Top = 880 Width = 375 End End Begin VB.Label Label2 Alignment = 1 'Right Justify Caption = "ชื่อบทความ :" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 960 TabIndex = 17 Top = 480 Width = 1095 End Begin VB.Label Label1 Alignment = 1 'Right Justify Caption = "เลขที่บทความ :" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 222 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C00000& Height = 255 Left = 720 TabIndex = 0 Top = 120 Width = 1335 End End Attribute VB_Name = "edit_index_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 list_itemtb As New ADODB.Recordset Dim magazinetab As New ADODB.Recordset Dim msubjtab As New ADODB.Recordset Dim mauthnametab As New ADODB.Recordset Dim artctrltab As New ADODB.Recordset Dim mauthfiletab As New ADODB.Recordset Dim articletab As New ADODB.Recordset Dim marticletab As New ADODB.Recordset Dim max_articleno As Integer Dim index_sub As Integer Dim index_auth As Integer Private Sub Cmdcancel_Click() Call lockinput Call search_indexj Text1.Locked = False Text1.BackColor = &HC0FFFF Cmdnext.Enabled = True Cmdprev.Enabled = True Cmdedit.Visible = True Cmddel.Enabled = True Cmdsave.Enabled = False Cmdcancel.Enabled = False Command3.Enabled = False End Sub Private Sub Cmddel_Click() Dim run_artipoint As Integer Dim s_artipoint As String Dim n As Integer If MsgBox("ต้องการลบข้อมูลหรือไม่", vbQuestion + vbOKCancel, "ยืนยันการลบข้อมูล") = vbOK Then Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 Conn.Execute "DELETE FROM ARTICLE WHERE ARTICLE_NO='" & Text1.Text & "';" Conn.Execute "DELETE FROM MAUTHFILE WHERE ARTICLE_NO='" & Text1.Text & "';" Conn.Execute "DELETE FROM MSUBJECT WHERE ARTICLE_NO='" & Text1.Text & "';" Conn.Close Text1.Text = Trim(Str(Val(Text1.Text) - 1)) run_artipoint = Val(Trim(Text1.Text)) s_artipoint = Trim(Str(run_artipoint)) For n = 1 To 7 - Len(s_artipoint) s_artipoint = "0" + s_artipoint Next n Text1.Text = s_artipoint Call Cmdcancel_Click End If End Sub Private Sub Command1_Click() Dim line_item As Integer If Trim(Text7.Text) = "" Then MsgBox "กรุณากรอกข้อมูลรายชื่อวารสารก่อน", vbCritical + vbOKOnly, "ข้อผิดพลาด" Exit Sub End If With show_item .ColWidth(0) = 950 .ColWidth(1) = 1200 .ColWidth(2) = 600 .ColWidth(3) = 700 .ColWidth(4) = 5000 .TextMatrix(0, 0) = "เลขทะเบียน" .TextMatrix(0, 1) = "ประจำเดือน" .TextMatrix(0, 2) = "ปีที่" .TextMatrix(0, 3) = "เล่มที่" .TextMatrix(0, 4) = "คำอธิบาย" End With line_item = 1 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 list_itemtb = New ADODB.Recordset With list_itemtb If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from tranfile Where trim(pointer)='" & Text13.Text & "' order by daily desc", Conn, adOpenForwardOnly, adLockReadOnly 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") .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 show_item.Visible = True show_item.HighLight = flexHighlightWithFocus End With Else MsgBox "รายชื่อวารสารนี้ไม่พบข้อมูลการลงทะเบียน", vbCritical + vbOKOnly, "ไม่พบวารสารที่ลงทะเบียน" End If .Close End With Set list_itemtb = Nothing End Sub Private Sub Command2_Click() If Conn.State = adStateOpen Then Conn.Close Set Conn = Nothing End If Unload Me End Sub Private Sub clear_input() Dim i As Integer Text2.Text = "" For i = 0 To 2 Text3(i).Text = "" Next i For i = 0 To 2 Text4(i).Text = "" Next i For i = 0 To 4 Text6(i).Text = "" Next i Text5.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" End Sub Private Sub Cmdsave_Click() Dim num_subj As Integer Dim num_auth As Integer Dim n As Integer Dim run_artipoint As Integer Dim s_artipoint As String Dim m_seqno As Integer If MsgBox("ต้องการบันทึกข้อมูลหรือไม่", vbQuestion + vbOKCancel, "Confirn") = vbOK Then Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 articletab = New ADODB.Recordset With articletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from article where article_no='" & Text1.Text & "'", Conn, adOpenForwardOnly, adLockOptimistic If Not .EOF Then .Fields(0).Value = Text1.Text .Fields(1).Value = Text2.Text .Fields(2).Value = " " .Fields(3).Value = Text13.Text .Fields(4).Value = Text8.Text .Fields(5).Value = Text9.Text .Fields(6).Value = Text10.Text .Fields(7).Value = Text11.Text .Fields(8).Value = Text12.Text .Fields(9).Value = Text5.Text .Update End If .Close End With Set articletab = Nothing 'บันทึกผู้แต่ง Set mauthfiletab = New ADODB.Recordset With mauthfiletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from mauthfile where article_no='" & Text1.Text & "' order by seqno", Conn, adOpenForwardOnly, adLockOptimistic m_seqno = 0 For num_auth = 0 To 2 If Trim(Text3(num_auth).Text) <> "" Then m_seqno = m_seqno + 1 If .EOF Then .AddNew .Fields(0).Value = Text1.Text .Fields(1).Value = m_seqno .Fields(2).Value = Trim(Text4(num_auth).Text) .Fields(3).Value = Text2.Text .Update Else If Not .EOF Then .Delete .Update End If End If If Not .EOF Then .MoveNext Next num_auth .Close End With Set mauthfiletab = Nothing 'บันทึกหัวเรื่อง Set msubjtab = New ADODB.Recordset With msubjtab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from msubject where article_no='" & Text1.Text & "' order by seqno", Conn, adOpenForwardOnly, adLockOptimistic m_seqno = 0 For num_subj = 0 To 4 If Trim(Text6(num_subj).Text) <> "" Then m_seqno = m_seqno + 1 If .EOF Then .AddNew .Fields(0).Value = Text1.Text .Fields(1).Value = m_seqno .Fields(2).Value = Trim(Text6(num_subj).Text) .Fields(3).Value = Text2.Text .Update Else If Not .EOF Then .Delete .Update End If End If If Not .EOF Then .MoveNext Next num_subj .Close End With Set msubjtab = Nothing Conn.Close Set Conn = Nothing Call Cmdcancel_Click 'Cmdedit.Visible = True 'Cmdsave.Enabled = False End If End Sub Private Sub Cmdedit_Click() Call unlockinput Command3.Enabled = True Cmdedit.Visible = False Cmdnext.Enabled = False Cmdprev.Enabled = False Cmddel.Enabled = False Cmdsave.Enabled = True Cmdcancel.Enabled = True Text1.Locked = True Text1.BackColor = &HE0E0E0 Text2.SetFocus End Sub Private Sub Cmdnext_Click() Dim n As Integer Dim run_artipoint As Integer Dim s_artipoint As String Do While True If Val(Trim(Text1.Text)) >= max_articleno - 1 Then MsgBox "Record สุดท้ายของฐานข้อมูลแล้ว", vbInformation + vbOKOnly, "End Of File" Exit Do Else Call clear_input End If run_artipoint = Val(Trim(Text1.Text)) + 1 s_artipoint = Trim(Str(run_artipoint)) For n = 1 To 7 - Len(s_artipoint) s_artipoint = "0" + s_artipoint Next n Text1.Text = s_artipoint Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 articletab = New ADODB.Recordset With articletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from article where article_no ='" & Text1.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then articletab.Close Set articletab = Nothing Conn.Close Set Conn = Nothing Call search_indexj Exit Do End If End With Loop End Sub Private Sub Cmdprev_Click() Dim n As Integer Dim run_artipoint As Integer Dim s_artipoint As String Do While True If Val(Trim(Text1.Text)) <= 1 Then MsgBox "Record แรกของฐานข้อมูลแล้ว", vbInformation + vbOKOnly, "Begin Of File" Exit Do Else Call clear_input End If run_artipoint = Val(Trim(Text1.Text)) - 1 s_artipoint = Trim(Str(run_artipoint)) For n = 1 To 7 - Len(s_artipoint) s_artipoint = "0" + s_artipoint Next n Text1.Text = s_artipoint Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 articletab = New ADODB.Recordset With articletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from article where article_no ='" & Text1.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then articletab.Close Set articletab = Nothing Conn.Close Set Conn = Nothing Call search_indexj Exit Do End If End With Loop End Sub Private Sub Command3_Click() Frame4.Visible = True Text5.SetFocus End Sub Private Sub Command4_Click() Frame4.Visible = False End Sub Private Sub dlbnamemag_Click() Text13.Text = dlbnamemag.BoundText Text7.Text = dlbnamemag.Text dlbnamemag.Visible = False If Conn.State = adStateOpen Then Conn.Close End Sub Private Sub Form_Load() Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 artctrltab = New ADODB.Recordset With artctrltab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from artctrl", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then max_articleno = Val(.Fields(0).Value) .Close End With Set artctrltab = Nothing Conn.Close Set Conn = Nothing End Sub Private Sub Form_Resize() Call lockinput Text1.SetFocus End Sub Private Sub List_authname_Click() List_authname.Visible = False Text3(index_auth).Text = List_authname.Text Text4(index_auth).Text = List_authname.BoundText If Conn.State = adStateOpen Then Conn.Close End Sub Private Sub List_Index_Click() List_Index.Visible = False Text1.Text = List_Index.BoundText Cmdnext.Enabled = True Cmdprev.Enabled = True Cmdedit.Enabled = True marticletab.Close Set marticletab = Nothing Conn.Close Set Conn = Nothing Call search_indexj End Sub Private Sub list_subject_Click() list_subject.Visible = False Text6(index_sub).Text = list_subject.Text If Conn.State = adStateOpen Then Conn.Close End Sub Private Sub show_item_Click() show_item.Visible = False Text8.Text = show_item.TextMatrix(show_item.Row, 2) Text9.Text = show_item.TextMatrix(show_item.Row, 3) Text10.Text = show_item.TextMatrix(show_item.Row, 4) End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) Dim run_artipoint As Integer Dim s_artipoint As String Dim n As Integer If KeyAscii = 13 Then run_artipoint = Val(Trim(Text1.Text)) s_artipoint = Trim(Str(run_artipoint)) For n = 1 To 7 - Len(s_artipoint) s_artipoint = "0" + s_artipoint Next n Text1.Text = s_artipoint Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 articletab = New ADODB.Recordset With articletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from article where article_no ='" & Text1.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then articletab.Close Set articletab = Nothing Conn.Close Set Conn = Nothing Cmdnext.Enabled = True Cmdprev.Enabled = True Cmdedit.Enabled = True Cmddel.Enabled = True Call search_indexj Else articletab.Close Set articletab = Nothing Conn.Close Set Conn = Nothing MsgBox "ไม่พบเลจที่บทความนี้ กรุณาตรวจสอบอีกครั้ง", vbCritical + vbOKOnly, "ไม่พบข้อมูล" Call clear_input Text1.SetFocus End If End With End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 marticletab = New ADODB.Recordset With marticletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient '.Open "select Article_No,Article_Name from Article Where Article_Name LIKE '" & Text2.Text & "%'", Conn, adOpenForwardOnly, adLockReadOnly .Open "select Article_No,Article_Name from Article Where left(Article_Name,length('" & Text2.Text & "'))='" & Text2.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then List_Index.Visible = True Set List_Index.RowSource = marticletab List_Index.ListField = "Article_Name" List_Index.BoundColumn = "Article_No" Else marticletab.Close Set marticletab = Nothing Conn.Close Set Conn = Nothing MsgBox "ไม่พบข้อมูลที่ต้องการค้นหา กรุณาตรวจสอบอีกครั้ง", vbCritical + vbOKOnly, "ผลการค้นหา" Text2.SetFocus End If End With End If End Sub Private Sub Text3_DblClick(Index As Integer) Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 mauthnametab = New ADODB.Recordset With mauthnametab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select idno,penname from authname Where left(penname,length('" & Text3(Index).Text & "'))='" & Text3(Index).Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then List_authname.Visible = True Set List_authname.RowSource = mauthnametab List_authname.ListField = "penname" List_authname.BoundColumn = "idno" index_auth = Index Else MsgBox "ไม่พบข้อมูลที่ต้องการค้นหา กรุณาตรวจสอบอีกครั้ง", vbCritical + vbOKOnly, "ผลการค้นหา" Text6(Index).SetFocus End If End With End Sub Private Sub Text3_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 13 Then Call Text3_DblClick(Index) End Sub Private Sub Text6_DblClick(Index As Integer) 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 msubjtab = New ADODB.Recordset With msubjtab If .State = adStateOpen Then .Close .CursorLocation = adUseClient ' .Open "select subject from msubject Where subject LIKE '%" & Text6(Index).Text & "%' Group By subject ", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then list_subject.Visible = True Set list_subject.RowSource = msubjtab list_subject.ListField = "subject" index_sub = Index Else MsgBox "ไม่พบข้อมูลที่ต้องการค้นหา กรุณาตรวจสอบอีกครั้ง", vbCritical + vbOKOnly, "ผลการค้นหา" Text6(Index).SetFocus End If End With End Sub Private Sub Text6_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 13 Then Call Text6_DblClick(Index) End Sub Private Sub Text7_DblClick() 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 magazinetab = New ADODB.Recordset With magazinetab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select pointer,Magazine_Name from magazine Where Magazine_Name LIKE '%" & Text7.Text & "%'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then dlbnamemag.Visible = True Set dlbnamemag.RowSource = magazinetab dlbnamemag.ListField = "Magazine_name" dlbnamemag.BoundColumn = "Pointer" dlbnamemag.ToolTipText = dlbnamemag.BoundText Else MsgBox "ไม่พบข้อมูลที่ต้องการค้นหา กรุณาตรวจสอบอีกครั้ง", vbCritical + vbOKOnly, "ผลการค้นหา" Text7.Text = "" Text7.SetFocus End If End With End Sub Sub search_indexj() Dim n_coun As Integer Set Conn = New ADODB.Connection If Conn.State = adStateOpen Then Conn.Close 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 articletab = New ADODB.Recordset With articletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select * from article where article_no ='" & Text1.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then Cmdedit.Visible = True Call lockinput Text2.Text = .Fields(1).Value Text8.Text = .Fields(4).Value Text9.Text = .Fields(5).Value Text10.Text = .Fields(6).Value Text11.Text = .Fields(7).Value Text13.Text = .Fields(3).Value If Not IsNull(.Fields(9).Value) Then Text5.Text = .Fields(9).Value If Not IsNull(.Fields(8).Value) Then Text12.Text = .Fields(8).Value articletab.Close 'ค้นรายชื่อวารสาร Set magazinetab = New ADODB.Recordset With magazinetab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select Magazine_Name from magazine Where pointer='" & Text13.Text & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then Text7.Text = .Fields(0).Value End With magazinetab.Close Set magazinetab = Nothing 'ค้นหาชื่อผู้แต่ง Set mauthfiletab = New ADODB.Recordset With mauthfiletab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select idno from mauthfile Where article_no='" & Text1.Text & "' order by seqno", Conn, adOpenForwardOnly, adLockReadOnly n_coun = 0 Do While Not .EOF Set mauthnametab = New ADODB.Recordset With mauthnametab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select penname from authname Where idno='" & mauthfiletab.Fields(0).Value & "'", Conn, adOpenForwardOnly, adLockReadOnly If Not .EOF Then If n_coun <= 2 Then Text3(n_coun).Text = .Fields(0).Value Text4(n_coun).Text = mauthfiletab.Fields(0).Value End If End If End With mauthnametab.Close Set mauthnametab = Nothing .MoveNext n_coun = n_coun + 1 Loop End With mauthfiletab.Close Set mauthfiletab = Nothing 'ค้นหาหัวเรื่อง Set msubjtab = New ADODB.Recordset With msubjtab If .State = adStateOpen Then .Close .CursorLocation = adUseClient .Open "select subject from msubject Where article_no='" & Text1.Text & "' order by seqno", Conn, adOpenForwardOnly, adLockReadOnly n_coun = 0 Do While Not .EOF Text6(n_coun).Text = .Fields(0).Value .MoveNext n_coun = n_coun + 1 Loop End With msubjtab.Close Set msubjtab = Nothing End If End With Set articletab = Nothing Conn.Close Set Conn = Nothing End Sub Sub unlockinput() Dim i As Integer For i = 0 To 2 Text3(i).BackColor = &HFFFFC0 Text3(i).Locked = False Next i For i = 0 To 4 Text6(i).BackColor = &HC0E0FF Text6(i).Locked = False Next i Text7.BackColor = &HC0FFFF Text7.Locked = False Text8.BackColor = &HC0FFFF Text8.Locked = False Text9.BackColor = &HC0FFFF Text9.Locked = False Text10.BackColor = &HC0FFFF Text10.Locked = False Text11.BackColor = &HC0FFFF Text11.Locked = False Text12.BackColor = &HC0FFFF Text12.Locked = False End Sub Sub lockinput() Dim i As Integer For i = 0 To 2 Text3(i).BackColor = &HE0E0E0 Text3(i).Locked = True Next i For i = 0 To 4 Text6(i).BackColor = &HE0E0E0 Text6(i).Locked = True Next i Text7.BackColor = &HE0E0E0 Text7.Locked = True Text8.BackColor = &HE0E0E0 Text8.Locked = True Text9.BackColor = &HE0E0E0 Text9.Locked = True Text10.BackColor = &HE0E0E0 Text10.Locked = True Text11.BackColor = &HE0E0E0 Text11.Locked = True Text12.BackColor = &HE0E0E0 Text12.Locked = True End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Text7_DblClick End Sub