กระทู้เก่าบอร์ด อ.Yeadram
        
           1,502   3		  
          
					  
		    URL.หัวข้อ / 
		    URL
        
        ช่วยด้วยนะคะ ใส่ where ใน sql update ไม่ได้น่ะค่ะ      
    
      ต้องการใส่ where ตรง update ค่ะแต่ไม่รุจะใส่ยังไง มันขึ้นว่า syntax error มั่ง end of statement มั่ง ใส่ไม่ได้เลยค่ะ
c = [Forms]![FrmBill].[Form]![txtProdCode] อันนี้คือรับรหัสสินค้าจากฟอร์มค่ะ
อยากให้มันอัพเดทที่ where ProdCode = c
แต่ใส่ตรงไหนยังไงก้ไม่ได้สักทีค่ะ
Private Sub Command56_Click()
Dim a As Integer
Dim b As Integer
Dim sql As String
Dim c As Integer
Dim d As String
a = [Forms]![FrmBill].[Form]![txtQty]
b = CInt(DLookup("ProdQty", "tblProduct", "Prodcode='" & Me![txtProdCode] & "'"))
sql = "Update tblProduct set ProdQty=" & b - a
CurrentProject.Connection.Execute sql
End Sub
    
    
  c = [Forms]![FrmBill].[Form]![txtProdCode] อันนี้คือรับรหัสสินค้าจากฟอร์มค่ะ
อยากให้มันอัพเดทที่ where ProdCode = c
แต่ใส่ตรงไหนยังไงก้ไม่ได้สักทีค่ะ
Private Sub Command56_Click()
Dim a As Integer
Dim b As Integer
Dim sql As String
Dim c As Integer
Dim d As String
a = [Forms]![FrmBill].[Form]![txtQty]
b = CInt(DLookup("ProdQty", "tblProduct", "Prodcode='" & Me![txtProdCode] & "'"))
sql = "Update tblProduct set ProdQty=" & b - a
CurrentProject.Connection.Execute sql
End Sub
				3 Reply in this Topic. Dispaly 1  pages and you are on page number 1 
				
        
    1 @R13802    
        
  
      sql = "Update tblProduct set ProdQty = ProdQty - " & cstr(Forms!FrmBill.txtQty) & " where Prodcode = '" & Me.txtProdCode & "'"    
    
  
        
    2 @R13804    
        
  
      ไม่ได้อ่ะค่ะ มันขึ้นว่า syntax error T^T    
    
  
        
    3 @R13805    
        
    
      ได้แล้วค่ะ ขอบคุณมากนะคะ    
    
  
      Time: 0.1002s
    
      
		