/* */

Sunday, November 13, 2011

[belajar-access] Penyederhanaan Coding

 

Assalamu alaikum pakar access semua..

Apakah coding seperti dibawah ini bisa disederhanakan? coding ini saya
sendiri yg buat namun sepertinya kurang sederhana maklum lagi proses
belajar VBA.

Private Sub CmdReportSummary_Click()
On Error GoTo Err_CmdReportSummary_Click

Dim stDocName As String

If Me.TxtStartDate = "" Then
MsgBox "Maaf anda belum melengkapi tanggal periode Year to
Date", vbInformation, "Warning"

Else
If Me.TxtStartWeek = "" Or Trim(Me.TxtStartWeek) = "Start Periode" Then
MsgBox "Maaf anda belum melengkapi tanggal periode 'For The
Week'", vbInformation, "Warning"

Else
If Me.TxtStartMonth = "" Or Me.TxtEndMonth = "" Then
MsgBox "Maaf anda belum melengkapi tanggal periode 'For The
Month'", vbInformation, "Warning"

Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "QSummDayCultureStockUpdate"
DoCmd.OpenQuery "QSummMonthCultureStockUpdate"
DoCmd.OpenQuery "QSummWeekCultureStockUpdate"
DoCmd.OpenQuery "QSummYearCultureStockFinalUpdate"
stDocName = "RptSummCultureStock"
DoCmd.OpenReport stDocName, acPreview

DoCmd.SetWarnings True

Exit_CmdReportSummary_Click:
Exit Sub

Err_CmdReportSummary_Click:
MsgBox Err.Description
Resume Exit_CmdReportSummary_Click
End If
End If
End If

End Sub

Sebelumnya saya ucapkan terimakasih

Regards
CW

__._,_.___
Recent Activity:
SPAM IS PROHIBITED
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

No comments:

Post a Comment