ขอบพระคุณครับท่าน ถ้าไม่ได้การช่วยรีโมท สงสัยฟอร์มจะเละไปใหญ่ ตอนนี้ก็ยังไม่เข้าใจ textbox กับ label ต่างกัน?
Code ที่ถูกต้องแล้ว
Private Sub goods_id_AfterUpdate()
Call CheckS_Price
End Sub
--------------------
Sub CheckS_Price()
Dim LastDate As String
Dim strPurchase_history As String
If Not IsNull(Me.date_sale) And Not IsNull(Me.goods_id) And Not IsNull(Forms!ACC_ºÑ¹·Ö¡¢ÒÂÊÔ¹¤éÒ!txtcust_id) Then
strPurchase_history = Nz(DLookup("[cust_id]", "[fsale]", "[goods_id] = '" & goods_id & "' And [cust_id] ='" & Forms!ACC_ºÑ¹·Ö¡¢ÒÂÊÔ¹¤éÒ!txtcust_id & "'"), 0)
LastDate = Nz(DLast("date_sale", "[fsale]", "[goods_id] = '" & goods_id & "' And [cust_id] ='" & Forms!ACC_ºÑ¹·Ö¡¢ÒÂÊÔ¹¤éÒ!txtcust_id & "'"), 0)
Me.s_price = Nz(DLookup("[s_price]", "[fsale]", "cstr([date_sale]) ='" & LastDate & "' And [goods_id] ='" & goods_id & "' And [cust_id] ='" & Forms!ACC_ºÑ¹·Ö¡¢ÒÂÊÔ¹¤éÒ!txtcust_id & "'"), 0)
End If
End Sub