แสดงกระทู้

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 - nonc31

หน้า: [1] 2 3 4 ... 9
1
Monday1  Monday2  1 หรือ 2 ได้มายังไงครับ

สร้างโมดูล
Function dayname(d)
    If Weekday(d) = 1 Then dayname = "Sunday"
    If Weekday(d) = 2 Then dayname = "Monday"
    If Weekday(d) = 3 Then dayname = "Tuesday"
    If Weekday(d) = 4 Then dayname = "Wednesday"
    If Weekday(d) = 5 Then dayname = "Thursday"
    If Weekday(d) = 6 Then dayname = "Friday"
    If Weekday(d) = 7 Then dayname = "Saturday"
End Function

ใส่สูตรในคิวรี่
การรัน ID : dayname([วันที่]) & "ค่า1หรือ2 จะเอามาจากไหนน้อ" & "-" & IIf([หมายเลขตัวอย่าง] Mod 100=0,100,[หมายเลขตัวอย่าง] Mod 100)

ปล. ค่าตัวเลขต่อท้ายชื่อวัน หาใส่เองนะครับ

2
Me.assdate = Now()
ตอนเพิ่มข้อมูล หรือ ตอนบันทึกข้อมูลเสร็จ เลือกเอาอย่างใดอย่างหนึ่ง  และ รูปแบบการเก็บข้อมูลของ assdate ก็ต้องเป็น General Date

3
Function updateAmountNew()
   On Error GoTo erC

        Dim db As Database
        Dim rstOut As Recordset
        Dim f As Field
        Dim taw As String
            Set db = CurrentDb
            Set rstOut = CurrentDb.OpenRecordset("ตาราง/คิวรี่")
           
        rstOut.MoveFirst
        Do Until rstOut.EOF
            If InStr(rstOut.Fields("DebitCredit").Value, "Credit") > 0 Then
                taw = rstOut.Fields("Amount").Value
            End If
        For Each f In rstOut.Fields
            DoCmd.SetWarnings False
            rstOut.Edit
            rstOut![AmountNew] = taw
            rstOut.Update
        Next
            rstOut.MoveNext
            If InStr(rstOut.Fields("DebitCredit").Value, "Credit") <= 0 Then
                taw = taw
            Else
                taw = rstOut.Fields("Amount").Value
            End If
        Loop
       
            rstOut.Close
            Set db = Nothing

Exit Function

erC:
    Select Case Err
        Case 0
        Case 3021
            Exit Function
        Case Else
            MsgBox "Function updateAmountNew" & " > " & Err.Description & " รหัส " & Err.Number
    End Select
End Function

4
ใช้แบบนี้ครับ
โค๊ด: [Select]
=DLookUp("[fname]","[students]","[code]=[Forms]![FeditGroup]![fsubEditGroup].form.[code]")

5
น่าจะแบบนี้

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord


ถ้าไม่ได้คงต้องส่งลบด้วยคิวรี่

6
ตย. แกะเอาเด้อ

7
ผมเคยทำของ สธ. คำนวณ ณ 30 ก.ย.  แต่ก็ซับซ้อน เรื่องการคำนวณ ทำ 7 คิวรี่ + 2 แมรโคร ทำงานร่วมกัน  พอถึง 1 บาท  ถ้าครุภัณฑ์ยังไม่จำหน่าย ก็ใส่ 1 บาท ไปเรื่อยๆ จนกว่าจะจำหน่าย   :sweat: :sweat: :sweat:


8
ห้อง MS Access / : การใช้ MsgBox
« เมื่อ: 01 ก.ค. 66 , 23:45:14 »
ป้องกันการปิดด้วย X
Private Sub Form_Unload(Cancel As Integer)
    Cancel = True
End Sub

ยกเลิกการป้องกันการปิดด้วย X
Private Sub Command1_Click()
   Me.OnUnload = ""
End Sub

9
ไฟล์อาจจะไม่อยู่ในรูปแบบของ Excel อาจเป็นรูปแบบ html ลองบันทึกแฟ้มเป็น Excel2003 (.xls) ลองดูครับ

11
สั่ง "พิมพ์" ออกด้วยไดรเวอร์ปริ๊นเตอร์ ของโปรแกรม Snagit   :cool: :cool: :cool: :cool:

12
ไม่รู้ใช่ป่าวแบบนี้

13
Private Sub Command13_Click()
On Error Resume Next
DoCmd.OutputTo acOutputReport, "rptSugarOrder", _
acFormatPDF, ""
End Sub

14
Private Sub Command0_Click()
    If Len([TEL TU(P)]) > 0 Then t1 = 1
    If Len([TEL TU(O)]) > 0 Then t2 = 1
    If Len([TEL TU(R)]) > 0 Then t3 = 1
    If Len([TEL TM]) > 0 Then t4 = 1
    If Len([TEL TO]) > 0 Then t5 = 1
    If Len([TEL TOI]) > 0 Then t6 = 1
   
    If t1 + t2 + t3 + t4 + t5 + t6 >= 3 Then
        MsgBox "มีการติดต่อ " & t1 + t2 + t3 + t4 + t5 + t6 & " แล้ว", vbExclamation, "แจ้ง"
    End If
End Sub

15
ใช้ Not in โค๊ดก็สั้นลงได้นิดนึง
=IIf([txtresident]=[tb_resident] And [txtresident] Not In("1","4","16","19","2","20","24","25","26","27"),"Individual","Archrive")

16
ตัวอย่าง  แกะ/ดัดแปลง ดูครับ  https://www.thai-access.com/index.php?topic=1494.0

17
ไม่รู้ว่ามีฟังชั่นของ Access ในตัวมันเองหรือป่าว  แต่ทำฟังชั่นใช้เองก็ O ยุนะครับ  :cool: :cool: :cool: :cool:

18
ใช้โค๊ด Loopๆๆ  แกะดูนะครับ  ดูงงๆ หน่อย ผมก็ลอกมา  :shout: :shout: :shout: :shout: :shout:

หน้า: [1] 2 3 4 ... 9