541
ห้อง MS Access / > ใช้Combobox กรองข้อมูลในQuery
« เมื่อ: 28 ก.พ. 61 , 16:16:26 »
มีอีกแบบนะครับ ใช้ตัวนี้แทน ทำให้แสดง All ไว้ตลอด ตอนกดเลือกรายการครับ
โหลดตัวอย่างได้ด้านล่าง
โหลดตัวอย่างได้ด้านล่าง
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.
Private Sub Form_Current()
Call PlaymusicOnForm
End Sub
Sub PlaymusicOnForm()
Dim LinkAddress As String
LinkAddress = "C:\Sound\SleepAway.mp3" 'กำหนดตำแหน่งไฟล์เสียง
Me.WindowsMediaPlayer.URL = LinkAddress
Me.WindowsMediaPlayer.Visible = False
End Sub
SELECT Item.Date, Item.item AS ItemToTal, Item.name, Item.QTY, IIf(IsNull([Shipment_Qty]),"0",[Shipment_Qty]) AS ShipmentQty, IIf(IsNull([Received_Qty]),"0",[Received_Qty]) AS Receiving, [Qty]-[ShipmentQty]+[Receiving] AS Qty_Today
FROM (Item LEFT JOIN Shipment ON Item.item = Shipment.ItemShip) LEFT JOIN Receiving ON Item.Item = Receiving.ItemReceived;
SELECT Item.Date, Item.item AS ItemToTal, Item.name, Item.QTY, IIf(IsNull([Shipment_Qty]),"0",[Shipment_Qty]) AS ShipmentQty
FROM Item LEFT JOIN Shipment ON Item.item = Shipment.ItemShip;
Private Sub Edit_Click()
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Tproduct.* FROM Tproduct" 'ให้ลบข้อมูลเก่าก่อนที่จะวางข้อมูลใหม่ที่ระบุ
DoCmd.OpenQuery "T_Append"
DoCmd.SetWarnings True
DoCmd.Close
DoCmd.OpenForm "Form1"
End Sub
Private Sub Form1_Close()
DoCmd.SetWarnings False
DoCmd.OpenQuery "T_Update"
DoCmd.RunSQL "DELETE Tproduct.* FROM Tproduct"
DoCmd.SetWarnings True
DoCmd.OpenForm "Form2"
End Sub
Function fCopy(strDest As String, strSrc As String)
Dim fs As Object, strTime As String
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfile strDest, strSrc, True
End Function
Sub CopyFile
Dim fold
Set fold = CreateObject("Scripting.FileSystemObject")
newFDR = "D:\........." 'ใส่ Path ที่จะเก็บไฟลฺ์ ถ้ายังไม่มี Folder ให้สร้างใหม่ตามที่เรากำหนด
If Not fold.FolderExists(newFDR) Then
fold.CreateFolder (newFDR)
End If
fCopy "C:\pic1.jpg", "D:\pic1.jpg" 'ตัวอย่างนี้ให้ Copy รูปจาก C:\ ไป D:\ เลือกตำแหน่งใหม่ได้ตามต้องการ
End sub
If Me.Text22 = 0 Then
Me.Text22 = Me.Text22
Else
Me.Text22 = Me.Text22 - 1
End If