Jumat, 15 November 2019

Re: [MS_AccessPros] Re: The Update query issue

 

I thought the same thing initially but it is matched. I was then confused by what looks to be comparing a date to False.
If (DateDiff("d", EventEndDt, currDate) > 0) And ProcessedInv = True And ProcessEventEndDt = False Then

Duane

From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Friday, November 15, 2019 2:34 PM
To: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com>
Subject: [MS_AccessPros] Re: The Update query issue
 


Jim - I see a wayward parenthesis right before DateDiff. Either remove it or put a closing paren after ProcessEventEndDt = False
If (DateDiff("d", EventEndDt, currDate) > 0) And ProcessedInv = True And ProcessEventEndDt = False Then

-Bill

---In MS_Access_Professionals@yahoogroups.com, <luvmymelody@yahoo.com> wrote :

Hello all,


I am having issues with a line of code for the UPDATE statement. I have created a query and then created the update query and pasted the sql statement into the line of code and modified it to be relevant and it is still not working. can someone give me some direction please. It is a mission critical database and the user is calling my boss and complaining



Thank You


Jim Wagner


here is the code. it is crashing on the


Do While Not rs2.EOF
    Id = rs2!EventID
    ProcessedInv = rs2!ProcessedInv
    ProcessEventEndDt = rs2!ProcessEventEndDt
    EventEndDt = rs2!EventEndDt
   ' MsgBox "INner Loop" & EventEndDt & currDate & Id, vbInformation
   'if the event is over but the inventory is not put back, the loop in run
    If (DateDiff("d", EventEndDt, currDate) > 0) And ProcessedInv = True And ProcessEventEndDt = False Then
   
       ' MsgBox "INnermost Loop" & EventEndDt & currDate & Id, vbInformation
        cntr = 0
        Set RS = Form_frmMainEvents.SubformEventDetails.Form.Recordset
        RS.MoveFirst
        Do While Not RS.EOF
       '  MsgBox "INnermost Loop" & EventEndDt & currDate & Id, vbInformation
            Q1 = Form_frmMainEvents![SubformEventDetails].Form![quantity]
            colName1 = Form_frmMainEvents![SubformEventDetails].Form![Item_Name]
            Lcntr = DateDiff("d", rs2!DeliveryDt, rs2!EventEndDt) + 1
            For cntr = 0 To Lcntr - 1
                invDate = DateAdd("d", cntr, rs2!DeliveryDt)
                CurrentDb.Execute " Update Tbl_InvDetails set [" & colName1 & "] = [" & colName1 & "] + " & Q1 & " where Tbl_InvDetails.InvDate = #" & invDate & "#  ", dbFailOnError
            Next
            RS.MoveNext
        Loop



__._,_.___

Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

.

__,_._,___

Tidak ada komentar:

Posting Komentar