Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading through tables 2

Status
Not open for further replies.

ncopeland

IS-IT--Management
Mar 12, 2002
88
GB
Hi All

I also have a further query with regards to reading from tables. I have a table called works order. In it there are 3 fields that need checked and updated.

First field is workscompletion (Yes/No).
Second field is costed (Yes/No).
Third field is costeddate (Date).

I want to read through the works order table and check to see if workscompletion is a "tick"(-1) and costed is a (0). If both these conditions are met then set costed = -1 and costeddate equal to todays date.

KR

NC.
 
Code:
   Dim SQL As String

   SQL = "UPDATE [Works Order] SET costed = True, costeddate = Date() " & _
    "WHERE workscompletion = True AND costed = False"

   CurrentDB.Execute SQL


 
Hi Joe

I had to update a few other fields i have coded as follows.

SQL = "UPDATE [WorksOrder] SET costed = True, costeddate = Date(), PeriodEnd = thePeriod, YearEnd = theYear " & "WHERE worksordercompletion = True AND costed = False"

Unfortunately I get an error 3061

Two few parameters. expected 2

KR

NC
 
SQL = "UPDATE WorksOrder SET costed=True,costeddate=Date(),PeriodEnd=" & thePeriod & ",YearEnd=" & theYear & " WHERE worksordercompletion=True AND costed=False"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top