แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - superdog

หน้า: [1]
1
ผมสมมุติ Field เก็บวันที่เริ่มทำงานของพนักงานชื่อ DateOfStartWork ตารางชื่อ Table1
ลองดูตัวอย่างนี้คับ
โพสต์นี้ได้รับคำขอบคุณจาก: superdog

2
ตัวอย่างคือการกำหนด ประเภทของ Control ครับ ถ้าเป็นประเภทที่เราเลือกเช่นจะสั่งให้ null หรือให้ว่าง ในประเภท textbox หรือ Combobox หรือ ให้เป็น False ใน checkbox ครับ

โค๊ด: [Select]
Sub ResetForm()   
    On Error GoTo Err_Err
    Dim ctl As Control
           
    For Each ctl In Me
        If ctl.ControlType = acComboBox Then
                ctl = Null       
        End If
        If ctl.ControlType = acTextBox Then
                ctl = Null
        End If
        If ctl.ControlType = acCheckBox Then
                ctl = False
        End If

          Next ctl
   
Exit_err:
        Exit Sub
Err_Err:
        MsgBox Error$
        MsgBox ("ผิดพลาดตรง Reset Form")
        Resume Exit_err

End Sub

เวลาจะเรียกใช้งานก็สั่ง Call ResetForm()

ส่วนประเภทของ Control ต่างๆ ที่มีใน access ก็ตามนี้เลยคับ
Constant              Control
acBoundObjectFrame   Bound object frame
acCheckBox              Check box
acComboBox              Combo box
acCommandButton      Command button
acCustomControl      ActiveX (custom) control
acImage                      Image
acLabel                      Label
acLine                      Line
acListBox                      List box
acObjectFrame              Unbound object frame or chart
acOptionButton              Option button
acOptionGroup              Option group
acPage                      Page
acPageBreak              Page break
acRectangle              Rectangle
acSubform       Subform/subreport
acTabCtl                      Tab
acTextBox      Text box
acToggleButton      Toggle button
โพสต์นี้ได้รับคำขอบคุณจาก: superdog

3
ลองโหลดไฟล์ท่านปิ่นณรงค์จากกระทู้ > การบันทึกข้อมูลลงตารางจากการใช้แบบฟอร์ม ไปแกะดูครับ ซึ่งจะมีทั้ง
- คีย์ข้อมูลหลายๆข้อมูลในฟอร์ม
- เมื่อกดบันทึกแล้วให้ข้อมูลที่อยู่ในหน้าฟอร์มนั้นหายไปเพื่อรอรับข้อมูลที่จะคีย์เข้าไปใหม่
โพสต์นี้ได้รับคำขอบคุณจาก: superdog

หน้า: [1]