ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 2 9

7 ѹҤ ..2549
84 Users On-Line.
Visitors - Page views
 8 9 7 3 8 7 2
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

PowerPoint Ѻкҹ Access - ÷к Login

Category »  Ѻ¤
: Webmaster 15/8/2553   : 14:32
(ҹ : 35559) 
㴡շͧѺ˹ҷ繷֡ Թŧҹਤѡ֡ ǢͧѺ÷ CAI (Computer Assisted Instruction) ùӤҪ·ͧͧ¹ ͹ .. ѧ硹ѡ֡ҷء ҡз˹Ҩ Login к öӢª (ʴդѺ ʴդ س ... ) ͤسҷ ˵ؼ Ӥҭµ 55555+ ... ԧ硹ѡ֡ҹ () ѧջʺó㹧ҹ͹ԧ ÷еդ觷͹ ǵͧѹҹʹٻẺͧͤ ҡҡ ... ѧ鹵ͧͧѡ¡͹ ... յҧͧԧҴǹͧõԴ͡Ѻҹ ... ... ҧç٧ѧФѺ ҡöӧҹѡ ´ (Թ 55555+) ͧ ͹Ըաâ鹵͹ҧ ... ҡҡ ʺóҡ鹹 ... ҡ ...
ǹŴ
ǹŴ PowerPoint Ѻкҹ Access - ÷к Login (PPT 2003)

ͧǢͧ
ù PowerPoint ҷ CAI
ù PowerPoint Ѻ CAI - ͹ҧ¹Ẻ䴹Ԥ
PowerPoint Ѻ ͹ ͹ҡҧѵ (Drag & Drop)
鹵͹ͧԴ§-ش§ Scene Ѻ SwishMax
úѹ֡§СͺüԵ͡¹͹ Acoustica MP3 Audio Mixer
÷ӢͺẺӴ Swishmax
ҷӢͺҹ Flash ѹͧҡ
÷ӻ Ẻ (֧ҡ) SwishMax (Flash Video)
ҧٻẺ Flash SwishMax ҧ
ҹ SwishMax Ѻ÷Ҿ͹ ... 鹰ҹش ᷺ҡ
Visual Basic 6.0 ѺþѲ͡¹ ͹
¹ SwishMax ( Flash) Ѻ觢ҡѺ MS Visual Basic 6.0 Ҥ 1
¹ SwishMax ( Flash) Ѻ觢ҡѺ MS Visual Basic 6.0 Ҥ 2
ҹ Drag & Drop VB 6 ;Ѳ͡¹ ͹ (Ҥ 1)
ҹ Drag & Drop VB 6 ;Ѳ͡¹ ͹ (Ҥ 2)
ŢӹǹẺӡѹ - Random Number
ûءҹ MS Visual Basic 6.0 ѺþѲ͡¹͹ (Եʵ˹ٹ)

ͧ һ繡ѹ ...
鹹 ˹ ͧҡ ͡Ҩҡҹͧ Visual Basic 6 + MS Access ¹͹˹ҹ Ǣͧ VB6 Ѻ÷˹Ҩ Login дѺҪվ Ҥ 1 - ... һѺ觹Դ˹ ٻẺ 觷ҹͧ Visual Basic for Application VBA Ѻ PowerPoint ...
õԴ͡ѺҹŴ ADO - ActiveX Data Objects

¡价 Microsoft Visual Basic Editor Alt + F11 ҡ͡ Tools --> References ... (͡ҾѺ)
ûѺ觤سѵԢͧ Control Ẻ Design Time ( õ駤ҤسѵԵҧͧ Control ͹ Run Macro)
  • ¨աõ駤 Properties ѡѧ仹 (繵ͧ仵駤ҷ¹ФѺ) (ҧҧ͵ҧ Control ҧǹФѺ)
      CommandButon ()
    • Name = cmdOK ( cmd Ͷ֧ Command Button Control)
    • Font = Angsana New (͡)
    • Caption = º͡ͻҡ价ӧҹ ÷ӧҹ
      TextBox (ͧ͡)
    • Name = txtUserID ( txt Ͷ֧ TextBox Control)
    • Font = Angsana New (͡)
    • Text = á˹Ѻ TextBox
    • BorderStyle = 1 - frmBoderStyleSingle (ͺͧ͹蹪Ѵ)
      Label (º͡)
    • Name = lblUserID ( lbl Ͷ֧ Label Control)
    • Font = Angsana New (͡)
    • Caption = º͡ ͸Ժ سһ͹ͼҹ
  • Ըͤá 캹 Slide ͧ PowerPoint (¡鹡á Escape)
    شʧ ͧ User öҶ֧ Slide Ҩзӡ Login кó
    ҡͧ Lock á öǹŴ Add-In ҹ

    Ըաҧ Module (ʡ BAS)
    Module 繡Ǻõҧ繵ͧҹ ͧöͧ繵ҹਤ 件֧èѴ纾ǡ (Sub Program Function) Ӥѭҹ ͷͧ¹鴢ʹء駴 ѧ鹡õ駪 Module ҹ ҵͧ駪ͤ modDataBase.bas ŷǢͧѺõԴ͡Ѻҹ 繵


    ҡ͡ Insert --> Module (ѧҡ鹡鴵ҧŧ)


    úѹ֡ Module ¡ҹѧ ਤա


    õ駪 õͤ㹧ҹ¹ФѺ

    VBA Ѻҹ Access ¡úѹ֡ Module
    ͡ҡ鴢ͧ Visual Basic 6 ҷź ... ԡ

    
    ' ˹ͧСȵ  Դá͹ҹ
    Option Explicit
    
    ' Global 繡ûСȵ÷ͧਤ
    
    ' ҹ MS Access
    Global ConnDB As New ADODB.Connection
    
    '  RecordSet ͵Դ͡Ѻҧ (Table)
    Global RS As New ADODB.Recordset
    
    ' ҧ Query  SQL Statement ͵Դ͡Ѻҧ
    Global Statement As String
    
    ' ҡк纪ͼҹ ()
    ' ҷ  ѹ к 纤ṹẺͺ ûҳФѺ
    Global CompleteName As String
    
    ' ######################################################
    ' ҹ MS Access
    ' ######################################################
    Sub OpenDataBase()
    On Error GoTo ErrorHandler
    Dim DB_File As String
        ' ҵ˹ Path Ѩغѹͧ PowerPoint
        '  C:\CAI\PowerPointDB
        DB_File = Application.ActivePresentation.Path
        If Right$(DB_File, 1) <> "\" Then DB_File = DB_File & "\"
    
        ' ǵªҹ MS Access
        '  C:\CAI\PowerPointDB\UserLog.MDB
        DB_File = DB_File & "UserLog.MDB"
    
        ' ҹ MS Access
        Set ConnDB = New ADODB.Connection
        ConnDB.ConnectionString = _
            "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=" & DB_File & ";" & _
            "Persist Security Info=False"
        ConnDB.Open
        Exit Sub
        
    ErrorHandler:
        ' ôѡ Error ҨԴ㹡
        MsgBox "Error : " & Err.Number & " " & Err.Description
        End
    End Sub
    
    ' ######################################################
    ' Դҹ MS Access
    ' ######################################################
    Sub CloseDataBase()
        ' Ǩͺա§ - Connect 
        If ConnDB.State = adStateOpen Then
            ConnDB.Close
            Set ConnDB = Nothing
        End If
    End Sub
    

    ӴѺ鹵͹÷ӧҹ

    VBA Ѻ Slide1 Ҩ繡͸Ժ¡ҹѺ Users
    
    ' ˹ͧСȵ  Դá͹ҹ
    Option Explicit
    
    ' ######################################################
    ' ˹Ҩ Slide 㹡û͹šк
    ' ######################################################
    Private Sub cmdOpen_Click()
        
        ' Դ͡Ѻҹ MS Access
        Call OpenDataBase
        
        ' 
        Slide2.txtUserID.Text = ""
        Slide2.txtPassword.Text = ""
        
        ' ¡˹ Slide ͧ Login ʴ
        ActivePresentation.SlideShowWindow.View.GotoSlide (2)
           
    End Sub
    
    ' ######################################################
    ' ÷ӧҹ Դ PowerPoint
    ' ######################################################
    Private Sub cmdExit_Click()
        ' ҧԧ PowerPoint
        With Application.Presentations("PowerPoint-Login.ppt")
            ' 觺ѹ֡ (Save) ͹͡
            .Saved = True
            .Close
        End With
    End Sub
    

    ӴѺ鹵͹÷ӧҹ
    ˹Ҩͧ͢͡Ẻ Design Time

    ӴѺ鹵͹÷ӧҹ
    ҧ UserID/Password ... admin/admin student/student

    ӴѺ鹵͹÷ӧҹ
    ö Login кº öҹѧ Slide

    VBA Ѻ Slide2 PowerPoint
    
    Option Explicit
    
    ' ######################################################
    ' 鹡кǹõǨͺªͼ  ʼҹ
    ' ¨äª User ҡ͹ ǤµǨͺʼҹѧ
    ' кҧҨա (Encrypt) ʼҹա˹
    ' ######################################################
    Private Sub cmdOK_Click()
    
    ' 纤ʼҹҡҧ
    Dim strPass As String
    
        ' Ǩͺҧ ... ҡѺ任͹ͼ  ʼҹ
        If Trim(txtUserID.Text) = "" Or Len(Trim(txtUserID.Text)) = 0 Then
            MsgBox "سһ͹ͼº¡͹.", vbOKOnly + vbExclamation, "§ҹʶҹ"
            ' ͡ҡ
            Exit Sub
        ElseIf Trim(txtPassword.Text) = "" Or Len(Trim(txtPassword.Text)) = 0 Then
            MsgBox "سһ͹ʼҹº¡͹.", vbOKOnly + vbExclamation, "§ҹʶҹ"
            ' ͡ҡ
            Exit Sub
        End If
        
        ' Ǩͺͼҹ͹к
        ' á˹ Set RS = New Recordset ¶֧ûԴ RecordSet ŧ (óԴҧ)
        Set RS = New Recordset
        Statement = "SELECT * FROM tblUser WHERE UserID = " & "'" & Trim(txtUserID) & "'"
        RS.CursorLocation = adUseClient
        RS.Open Statement, ConnDB, adOpenForwardOnly, adLockReadOnly, adCmdText
        
        '  RecordCount  ҵͧ駡ҹẺ RS.CursorLocation = adUseClient
        If RS.RecordCount > 0 Then
            
            strPass = "" & RS("Password")
            
        ' 辺Ѻ
        Else
            MsgBox "ͼҹ١ͧ سͧա.", vbOKOnly + vbExclamation, "§ҹʶҹ"
            RS.Close:   Set RS = Nothing
            Exit Sub
        End If
        
        ' ͪͼ١ͧ 仵ǨͺʼҹӴѺ
        ' Ǩͺʼҹͧҹ͹ҵçѹѺк »Ѻѡзء繵 (LCase)
        If LCase(txtPassword.Text) <> LCase(strPass) Then
            MsgBox "ʼҹ١ͧ سͧա.", vbOKOnly + vbExclamation, "§ҹʶҹ"
            RS.Close:   Set RS = Nothing
            Exit Sub
        End If
            
        
        ' 駡к
        MsgBox "Թյ͹Ѻس " & RS("CompleteName") & " к.", _
                    vbOKOnly + vbInformation, "кº"
        
        ' 纤ҵ ѡɳй  红żʴء Slide Ѻ
        ' 㹷ҧԺѵԨԧ Ҩеͧ纤  ѹ ҷ Login 
        CompleteName = "" & RS("CompleteName")
        
        ' 駪价˹ Slide Ѵ
        Slide3.lblWelcome.Caption = "Թյ͹Ѻس " & CompleteName & " 躷¹"
        
        ' Ѵ͵ҧ (Table) ѧԴҹŹФѺ
        RS.Close:   Set RS = Nothing
        
        
        ' ˹ Slide 
        ActivePresentation.SlideShowWindow.View.GotoSlide (3)
        
    End Sub
    ' ######################################################
    ' ÷ӧҹ Դ PowerPoint
    ' ######################################################
    Private Sub cmdExit_Click()
        
        ' ͤʹ¢ͧ ͧԴͰҹš͹
        Call CloseDataBase
        
        ' ͹Դ
        Slide2.txtUserID.Text = ""
        Slide2.txtPassword.Text = ""
        
        ' ҧԧ
        With Application.Presentations("PowerPoint-Login.ppt")
            ' 觺ѹ֡ (Save) ͹͡
            .Saved = True
            .Close
        End With
    
    End Sub
    
    Conclusion:
    ҧѴਹẺٻ ҡ PowerPoint ͡Ѻҹ öªҹա ҷ 红š ͧ͡¹Ф 纤ṹ÷Ẻͺ Pre-Test/Post-Test ա Тҹҵͧ㹡ûżŷҧʶԵԵ ¢Ũҡҹ觤繨ԧѧФѺ ... ͧ
    ͵ - g2gNet Dot Com
    Ţ¹ҳԪ硷͹ԡ 0407314800231
    CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
    Email: [email protected] . 08-6862-6560