Senin, 28 Januari 2019

[MS_AccessPros] Debug.Print does not work

 

Dear All,
Debug does not work this this code. Please help:

Private Sub Form_BeforeUpdate(Cancel As Integer)

On Error GoTo ErrHandle

Me.RecordDate = Date
Me.TransactionEmployeeID = Forms!frmWelcome!EmployeeID

Dim strSQL As String
Dim strContractCurrency As String
Dim strFinalCurrency As String

Dim strContractTotalAmount As Long '地接合同款
Dim strContractTotalAmountReceived As Long '地接团款已收
Dim strContractTotalAmountReceivedTXT As String
Dim strContractTotalAmountNotReceived '地接团款未收
Dim strContractTotalAmountNotReceivedTXT As String
Dim strContractTotalAmountReceivedPercent As Long '收到百分比
Dim strContractTotalAmountNotReceivedPercent As Long '未收到百分比

Dim strAirTicketInsuranceVisaTotal As Long '机保签款
Dim strTotalAirVisaInsuranceReceived As Long '机保签已收
Dim strTotalAirVisaInsuranceReceivedTXT As String
Dim strTotalAirVisaInsuranceNotReceived As Long '机保签未收
Dim strTotalAirVisaInsuranceNotReceivedTXT As String
Dim strTotalAirVisaInsuranceReceivedPercent As Long '收到百分比
Dim strTotalAirVisaInsuranceNotReceivedPercent As Long '未收到百分比

strContractCurrency = ELookup("ContractCurrency", "tblGroup", "GroupID=" & Nz(Me.GroupID, 0))
strFinalCurrency = ELookup("FinalCurrency", "tblGroup", "GroupID=" & Nz(Me.GroupID, 0))
strContractTotalAmount = ELookup("ContractTotalAmount", "tblGroup", "GroupID=" & Nz(Me.GroupID, 0))
strAirTicketInsuranceVisaTotal = ELookup("AirTicketInsuranceVisaTotal", "tblGroup", "GroupID=" & Nz(Me.GroupID, 0))

strContractTotalAmountReceived = Nz(DSum("AmountContract", "qryTransactionTotalCalc", "Checked=" & True & "AND OfficeLocationID=" & 1 & "AND CostTypeID=" & 17 & "AND GroupID=" & Nz(Me.GroupID, 0)), 0)
strContractTotalAmountReceivedTXT = strContractCurrency & " " & strContractTotalAmountReceived
strContractTotalAmountNotReceived = strContractTotalAmount - strContractTotalAmountReceived
strContractTotalAmountNotReceivedTXT = strContractCurrency & " " & strContractTotalAmountNotReceived
strContractTotalAmountReceivedPercent = IIf(strContractTotalAmount = 0, "", strContractTotalAmountReceived / strContractTotalAmount)
strContractTotalAmountNotReceivedPercent = IIf(strContractTotalAmount = 0, "", strContractTotalAmountNotReceived / strContractTotalAmount)

strTotalAirVisaInsuranceReceived = Nz(DSum("AmountFinal", "qryTransactionTotalCalc", "Checked=" & True & "AND OfficeLocationID=" & 1 & "AND CostTypeID=" & 21 & "AND GroupID=" & Nz(Me.GroupID, 0)), 0)
strTotalAirVisaInsuranceReceivedTXT = strFinalCurrency & " " & strTotalAirVisaInsuranceReceived
strTotalAirVisaInsuranceNotReceived = strAirTicketInsuranceVisaTotal - strTotalAirVisaInsuranceReceived
strTotalAirVisaInsuranceNotReceivedTXT = strFinalCurrency & " " & strTotalAirVisaInsuranceNotReceived
strTotalAirVisaInsuranceReceivedPercent = IIf(strAirTicketInsuranceVisaTotal = 0, "", strTotalAirVisaInsuranceReceived / strAirTicketInsuranceVisaTotal)
strTotalAirVisaInsuranceNotReceivedPercent = IIf(strAirTicketInsuranceVisaTotal = 0, "", strTotalAirVisaInsuranceNotReceived / strAirTicketInsuranceVisaTotal)

strSQL = "UPDATE tblGroup " & _
"SET [ContractTotalAmountReceived] = " & strContractTotalAmountReceived & ", " & _
"SET [ContractTotalAmountReceivedTXT] = ' " & strContractTotalAmountReceivedTXT & " ', " & _
"SET [ContractTotalAmountNotReceived] = " & strContractTotalAmountNotReceived & ", " & _
"SET [ContractTotalAmountNotReceivedTXT] = ' " & strContractTotalAmountNotReceivedTXT & " ', " & _
"SET [ContractTotalAmountReceivedPercent] = " & strContractTotalAmountReceivedPercent & ", " & _
"SET [ContractTotalAmountNotReceivedPercent] = " & strContractTotalAmountNotReceivedPercent & ", " & _
"SET [TotalAirVisaInsuranceReceived] = " & strTotalAirVisaInsuranceReceived & ", " & _
"SET [TotalAirVisaInsuranceReceivedTXT] = ' " & strTotalAirVisaInsuranceReceivedTXT & " ', " & _
"SET [TotalAirVisaInsuranceNotReceived] = " & strTotalAirVisaInsuranceNotReceived & ", " & _
"SET [TotalAirVisaInsuranceNotReceivedTXT] = ' " & strTotalAirVisaInsuranceNotReceivedTXT & " ', " & _
"SET [TotalAirVisaInsuranceReceivedPercent] = " & strTotalAirVisaInsuranceReceivedPercent & ", " & _
"SET [TotalAirVisaInsuranceNotReceivedPercent] = " & strTotalAirVisaInsuranceNotReceivedPercent & _
" WHERE GroupID = " & Me.GroupID

Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError

ErrExit:
Exit Sub

ErrHandle:
Resume ErrExit

End Sub

Thanks in advance,
Best Regards,
Kevin

__._,_.___

Posted by: <zhao.liqing@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar