Dear VB Master,
Saya mau bikin nomor otomatis dengan format seperti berikut :
0001YYMMDD.
Pertanyaan kenapa setelah 0001 isi kenapa tdk mau ke 0002YYMMDD dst.
berikut saya kirimkan sampel script yang saya buat, tolong dikoreksi, dimana
letak kesalahannya.
Private Sub Auto()
Dim oRSTrans3 As ADODB.Recordset
Set oRSTrans3 = New ADODB.Recordset
oRSTrans3.Open "select * from trans3 Where no_trans3 In(Select
Max(no_trans3)From Trans3)Order By no_trans3 Desc", oConn
oRSTrans3.Requery
Dim Urutan As String * 10
Dim Hitung As Long
With oRSTrans3
If .EOF Then
Urutan = "0001" + Right(Date, 2) + Mid(Date, 4, 2) + Left(Date, 2)
Text1 = Urutan
Else
If Right(!no_trans3, 6) <> Right(Date, 2) + Mid(Date, 4, 2) +
Left(Date, 2) Then
Urutan = "0001" + Right(Date, 2) + Mid(Date, 4, 2) + Left(Date,
2)
Else
Hitung = Left(!no_trans3, 4) + 1
Urutan = Left("0000" & Hitung, 4) + (Right(Date, 2) + Mid(Date,
4, 2) + Left(Date, 2))
End If
End If
Text1 = Urutan
End With
End Sub
Mohon pencerahan.
Terima kasih.
KP
[Non-text portions of this message have been removed]