91
ห้อง MS Access / : ระบบจองห้องประชุม
« เมื่อ: 05 มิ.ย. 61 , 21:01:05 »
ผมส่ง ID Line ไปทางข้อความนะครับ พี่ อาจจะต้องคุยกันยาวๆ เดี่ยวผมช่วยเต็มที่ครับ
โพสต์นี้ได้รับคำขอบคุณจาก: prajak
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.
ทำตามตัวอย่างได้แล้วครับ และถ้าเราต้องการ Source มากว่า2รายการที่ยกตัวอย่าง ก็ทำแบบเดียวกันเลยใช่มั้ยครับใช่ครับ คุณ prajak กำหนดที่ Union อันเดียวพอ
สวัสดีครับเพิ่มเติมอีกนิดนะพี่ ผมกำลังทดลองทำให้อยู่ แต่คงทำให้เป็นทีละส่วนๆไปนะครับ
ผมอยากได้แบบที่ 2 ครับผม
รบกวนด้วยนะครับ
SELECT Date, Output, 'POFab' as Source
FROM TblPOFab
UNION SELECT Date, Output, 'Production' as Source
FROM TblProduction;
จะได้ข้อมูลและชื่อตารางมาSELECT Sum1.Source, Sum(IIf([Month]="เดือน1",([output]))) AS เดือน1, Sum(IIf([Month]="เดือน2",([output]))) AS เดือน2, Sum(IIf([Month]="เดือน3",([output]))) AS เดือน3, Sum(IIf([Month]="เดือน4",([output]))) AS เดือน4, Sum(IIf([Month]="เดือน5",([output]))) AS เดือน5, Sum(IIf([Month]="เดือน6",([output]))) AS เดือน6, Sum(IIf([Month]="เดือน7",([output]))) AS เดือน7, Sum(IIf([Month]="เดือน8",([output]))) AS เดือน8, Sum(IIf([Month]="เดือน9",([output]))) AS เดือน9, Sum(IIf([Month]="เดือน10",([output]))) AS เดือน10, Sum(IIf([Month]="เดือน11",([output]))) AS เดือน11, Sum(IIf([Month]="เดือน12",([output]))) AS เดือน12
FROM Sum1
GROUP BY Sum1.Source, Sum1.Year
HAVING (((Sum1.Year)=[Forms]![Result]![getYears]));
ขอบคุณมากครับอ่อเปน Sub Form เดี่ยวแก้ให้ครับ
แต่ยัง error อยู่ครับ
คือโปรแกรมผม มันเป็น form ซ้อน form อยู่อ่ะครับ
ผมลองใส่ code ในตัว subform แล้วรันเฉพาะ subform
ใช้ได้ ไม่ error
แต่พอรัน form ชื่อ input มัน error
ทำไงดีคับ
Function FileNameGetUnique(sFileName As String) As String
Dim lCount As Long, lPosDot As Long
Dim sFileNoExtension As String, sExtension As String
On Error GoTo ErrFailed
If Len(sFileName) = 0 Then
Debug.Assert "ไม่เจอไฟล์ที่จะปรับปรุงนะครับ" & FileNameGetUnique
Exit Function
End If
lPosDot = InStrRev(sFileName, ".")
If lPosDot Then
sFileNoExtension = Left$(sFileName, lPosDot - 1)
sExtension = Mid$(sFileName, lPosDot)
Else
sFileNoExtension = sFileName
End If
Do
lCount = lCount + 1
Loop While Len(Dir$(sFileNoExtension & "(" & CStr(lCount) & ")" & sExtension))
FileNameGetUnique = sFileNoExtension & "(" & CStr(lCount) & ")" & sExtension
Exit Function
ErrFailed:
Debug.Print Err.Description
Debug.Assert False
FileNameGetUnique = ""
End Function