You are on page 1of 6

Dim Rs As DAO.

Recordset

Private Sub cmdBelumDicetak_Click()

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "# and
ybalik = -1 and yprinted = 0 order by pengirim_tgl, no_awb"

Form_perTanggalOutboundDetailPilih.Requery

Refresh

penomeran

End Sub

Private Sub cmdCetak_Click()

On Error Resume Next

biarin

Set Rs = CurrentDb.OpenRecordset("select * from tblInvoiceOutboundDetail where


format(pengirim_tgl,0) >= " & Format(dt, 0) & " and format(pengirim_tgl,0) <= " & Format(st, 0) & " and
yPilih = -1")

DoCmd.RunSQL "insert into tblOutboundPrinted (no_awb, yPrinted) select no_awb, yPilih from
tblInvoiceOutboundDetail where format(pengirim_tgl,0) >= " & Format(dt, 0) & " and
format(pengirim_tgl,0) <= " & Format(st, 0) & " and yPilih = -1"

'Report_invoice_Outbound_pertanggal_with_no_faktur.RecordSource = "select * from


tblInvoiceOutboundDetail where format(pengirim_tgl,0) >= " & Format(dt, 0) & " and
format(pengirim_tgl,0) <= " & Format(st, 0) & ""

'Report_invoice_Outbound_pertanggal_with_no_faktur.Requery
'Refresh

DoCmd.OpenReport "invoice_Outbound_pertanggal_with_no_faktur", acViewPreview

DoCmd.Maximize

End Sub

Private Sub cmdKeluar_Click()

DoCmd.Close

End Sub

Private Sub cmdPODBelumBalik_Click()

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "# and
ybalik = 0 and yprinted = 0 order by pengirim_tgl, no_awb"

Form_perTanggalOutboundDetailPilih.Requery

Refresh

penomeran

End Sub

Private Sub cmdPODSudahBalik_Click()

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "# and
ybalik = -1 and yprinted = 0 order by pengirim_tgl, no_awb"

Form_perTanggalOutboundDetailPilih.Requery

Refresh
penomeran

End Sub

Private Sub cmdTampilkanSemua_Click()

DoCmd.RunSQL "delete * from tblInvoiceOutboundDetail"

DoCmd.RunSQL "insert into tblInvoiceOutboundDetail (customer, ybalik, nom, no_awb, pengirim_tgl,


no_faktur, penerima_tujuan, yPrinted) select customer, ybalik, nom, no_awb, pengirim_tgl, no_faktur,
penerima, yPrinted from qryInvoice_Outbound_pertanggal_with_no_faktur"

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "#
order by pengirim_tgl, no_awb"

Form_perTanggalOutboundDetailPilih.Requery

Refresh

penomeran

End Sub

Private Sub dt_AfterUpdate()

On Error Resume Next

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "# and
ybalik = -1 and yprinted = 0 order by pengirim_tgl, no_awb"
Form_perTanggalOutboundDetailPilih.Requery

Refresh

penomeran

st.SetFocus

End Sub

Private Sub Form_Load()

On Error Resume Next

DoCmd.MoveSize , 0, 13700, 21000

DoCmd.SetWarnings False

DoCmd.RunSQL "delete * from tblInvoiceOutboundDetail"

DoCmd.RunSQL "insert into tblInvoiceOutboundDetail (customer, ybalik, nom, no_awb, pengirim_tgl,


no_faktur, penerima_tujuan, yPrinted) select customer, ybalik, nom, no_awb, pengirim_tgl, no_faktur,
penerima, yPrinted from qryInvoice_Outbound_pertanggal_with_no_faktur"

'Me.RecordSource = "select * from tblInvoiceOutboundDetail"

Form_perTanggalOutboundDetailPilih.RecordSource = "select * from tblInvoiceOutboundDetail where


pengirim_tgl between #" & Format(dt, "mm-dd-yyyy") & "# and #" & Format(st, "mm-dd-yyyy") & "# and
ybalik = -1 and yprinted = 0 order by pengirim_tgl, no_awb"

Form_perTanggalOutboundDetailPilih.Requery

Refresh
penomeran

End Sub

Private Sub st_AfterUpdate()

dt_AfterUpdate

End Sub

Sub penomeran()

On Error Resume Next

Dim Urut As Long

Form_perTanggalOutboundDetailPilih.OrderByOn = True

Form_perTanggalOutboundDetailPilih.OrderBy = "pengirim_tgl, no_awb"

Set Rs = Form_perTanggalOutboundDetailPilih.RecordsetClone

With Rs

'If Not .EOF Then


.MoveFirst

Do Until .EOF

Urut = Urut + 1

.Edit

!nom = Urut

.Update

.MoveNext

Loop

'End If

.Close

End With

Form_perTanggalOutboundDetailPilih.Requery

Refresh

End Sub

You might also like