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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query Need HELP

Status
Not open for further replies.

fiero131

Programmer
Aug 22, 2008
2
US
Can someone help me out and show me what I am doing wrong?


usql = "Update DocumentEntry Set DocumentEntry.Status = " & Me.NStatus.Value & ", DocumentEntry.ApprovedDate = " & Me.NApprovedDate.Value & ", DocumentEntry.Comments = " & Me.NComments.Value & " Where DocumentEntry.ProjectID = " & Me.ProjectID.Value & ""


DoCmd.SetWarnings False
DoCmd.RunSQL usql
DoCmd.SetWarnings True
 
How are ya fiero131 . . .

Perhaps the following will do:
Code:
[blue]   Dim db As DAO.Database, SQL As String, DQ As String
   
   Set db = CurrentDb
   DQ = """"
   
   SQL = "Update DocumentEntry " & _
         "Set [Status] = " & Me.NStatus & ", " & _
             "[ApprovedDate] = #" & Me.NApprovedDate & "#, " & _
             "[Comments] = " & DQ & Me.NComments & DQ & " " & _
         "Where [ProjectID] = " & Me.ProjectID & ";"
   db.Execute SQL, dbFailOnError
   
   Set db = Nothing[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
show me what I am doing wrong
What happens ? Any error message ? Unexpected behaviour ? Computer crash ? ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top