91
ห้อง MS Access / : สอบถามอยาก ทำข้อมูลผลรวม (มือใหม่)
« เมื่อ: 03 เม.ย. 62 , 18:56:15 »
ดูเหมือนเป็นการ Running Total นะครับ
โพสต์นี้ได้รับคำขอบคุณจาก: nawahovvp
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.
ส่งข้อความไปแล้วครับส่งไฟล์นั้นมาครับ เดี่ยวผมเพิ่มให้
ขนาดไฟล์เกินอะครับ รบกวนของ email ได้มั้ยครับผม
ทำยังไงรบกวนบอกรายละเอียดได้มั้ยครับ อยากเรียนรู้ด้วยครับผม
SELECT Table1.DateStart, Format([datestart],"dd/mm") & "/" & Format([datestart],"yyyy")+1 AS EventDate
FROM Table1;
Private Sub Form_Timer()
Static count As Integer
count = count + 1
If count = 30 Then
Me.TimerInterval = 0
Call checkeventdate
End If
End Sub
Sub checkeventdate()
Dim Ondate As Date
Dim Edate As Date
Ondate = Format(Now(), "DD/MM/YYYY")
Edate = Format(DLookup("Eventdate", "QryEventDate"))
If Edate = Ondate Then
MsgBox "มีข้อมูลที่ครบรอบปีแล้ว", vbInformation, "แจ้งเตือน!!"
End If
End Sub
Second: DateDiff("s",[ABS_SDATE],[ABS_ENDATE])
Private Sub Comment_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not IsNull(Me.Comment) And Not IsNull(Me.ID) Then
Me.Comment.ControlTipText = DLookup("Comment", "Table1", "ID =" & Me.ID & "")
Else
Me.Comment.ControlTipText = Null
End If
End Sub
ใส่ Input Mark ยังงัย ให้บันทึกไอดีต่างชาติ แบบนี้ได้ครับน่าจะแบบนี้นะครับ
0-0000-T035991-3
Private Sub Form_Load()
Me.Text2.InputMask = "0\-0000\-A000000\-0;0;_"
End Sub
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.id1 = "3" And Me.Team = Text3 Then
Me.Line1.Visible = True
Me.Line1.BorderColor = vbRed
Else
Me.Line1.Visible = False
End If
End Sub
ต้องการสร้าง กดปุ่ม button มีปุ่มบันทึกข้อมูล กับปุ่มจบการทำงาน
เขียนโค๊ตอย่างไรครับให้ปุ่มกดจบการทำงาน ไม่ทำงาน จนกว่าจะมีการกดปุ่มบันทึกข้อมูลถึงจะกลับมาทำงานได้ครับ
Private Sub BtnSave_Click()
Dim SaveEvent As String
Dim DB As Database
Dim RS As Recordset
If MsgBox("ต้องการบันทึกข้อมูลข้อมูล ?", vbOKCancel + vbQuestion, "สอบถาม") = vbOK Then
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("Table1", DB_OPEN_DYNASET)
RS.AddNew
RS![Field1] = Me.Text1
RS![Field2] = Me.Text2
RS![Field3] = Me.Text3
RS.Update
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
Call ResetForm
SaveEvent = "1" 'ถ้าเราบันทึกก็ให้ตัวแปร = 1
Else
SaveEvent = "0" 'ถ้าเราไม่บันทึกให้ตัวแปร = 0
End If
If SaveEvent = "1" Then
Me.BtnClose.Enabled = True
ElseIf SaveEvent = "0" Then
Me.BtnClose.Enabled = False
End If
End Sub
Function MyHexColor(ByVal StrHex)
If Len(StrHex) = 7 Then StrHex = Mid(StrHex, 2, 6)
If Len(StrHex) = 6 Then
num_array = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f")
char1 = LCase(Mid(StrHex, 1, 1))
char2 = LCase(Mid(StrHex, 2, 1))
char3 = LCase(Mid(StrHex, 3, 1))
char4 = LCase(Mid(StrHex, 4, 1))
char5 = LCase(Mid(StrHex, 5, 1))
char6 = LCase(Mid(StrHex, 6, 1))
For i = 0 To 15
If (char1 = num_array(i)) Then position1 = i
If (char2 = num_array(i)) Then position2 = i
If (char3 = num_array(i)) Then position3 = i
If (char4 = num_array(i)) Then position4 = i
If (char5 = num_array(i)) Then position5 = i
If (char6 = num_array(i)) Then position6 = i
Next
If IsEmpty(position1) Or IsEmpty(position2) Or IsEmpty(position3) Or IsEmpty(position4) Or IsEmpty(position5) Or IsEmpty(position6) Then
MyHexColor = -1
Else
MyHexColor = RGB(position1 * 16 + position2, position3 * 16 + position4, position5 * 16 + position6)
End If
Else
MyHexColor = -1
End If
End Function
Private Sub รายละเอียด_Paint()
If Not IsNull(Me.HEX) Then
Me.COLOR.BackColor = MyHexColor(HEX)
Else
Me.COLOR.BackColor = MyHexColor("#FFFFFF")
End If
End Sub
เช่น พนักงาน ID A001 อยากจะให้ดึงรูปภาพ ของพนักงานคนนั้น มาแสดงในฟอร์ม หรือ รายงาน โดยอยากให้ผูก ID กับชื่อ image file ทำอย่างไรครับ
\images\A001.jpg
\images\A002.jpg
\images\A003.jpg
\images\A004.jpg
ขอบคุณมากครับ