Kamis, 07 November 2013

[MS_AccessPros] SQL help!

 

Good morning friends.

I need help modifying this procedure which updates records in my Vinmaster table with values from controls on a form.:

Dim db As Database, strSQL As String
        Set db = CurrentDb
        strSQL = "UPDATE VinMaster SET VinMaster.CustPONo = " & """" & [Forms]![frmAddInvoiceDetail]![txtCustPO] & """, " & _
        "VinMaster.Mat_Labor = " & [Forms]![frmAddInvoiceDetail]![txtMatAndLabor] & ", " & _
        "VinMaster.FET = " & [Forms]![frmAddInvoiceDetail]![txtFET] & ", " & _
        "VinMaster.Freight = " & [Forms]![frmAddInvoiceDetail]![txtDelChg] & ", " & _
        "VinMaster.BOM = " & """" & [Forms]![frmAddInvoiceDetail]![cboBOM] & """" & _
        " WHERE (((VinMaster.[Cust ID])= " & """" & [Forms]![frmAddInvoiceDetail]![cboCustomer] & """) " & _
        "And (Vinmaster.[Invoiced]) = " & False & _
        " AND ((VinMaster.[Unit #]) Between """ & [Forms]![frmAddInvoiceDetail]![cboStartNo] & """" & _
        " And " & """" & [Forms]![frmAddInvoiceDetail]![cboEndNo] & """));"
        Debug.Print strSQL
        db.Execute strSQL, dbFailOnError
        MsgBox CStr(db.RecordsAffected) & " records updated.", vbInformation, "Records Updated"
        Set db = Nothing

 

The Vinmaster table has a yes/no field named Canadian. If Canadian is true, I would like the FET field to be zero else I want it to do what it does in the procedure above. I just don't know how to do that in SQL. I appreciate your help!

 

Doyce    

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar