Senin, 28 Januari 2019

Re: [MS_AccessPros] Debug.Print does not work

 

Does the code compile?  Have you set a break point and stepped through the lines of code?

Duane

 

From: ms_access_professionals@yahoogroups.com on behalf of qingqinga@yahoo.com [MS_Access_Professionals] <ms_access_professionals@yahoogroups.com>
Sent: Monday, January 28, 2019 9:47 PM
To: ms_access_professionals@yahoogroups.com
Subject: [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>
------------------------------------


------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/

__._,_.___

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 (2)

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