Hi All,
VB 6.0 and MS Access
While Saving Record, I want Number to be Generated in following Format
140208-001, 140208-002, 140208-003 . . . etc...
You must have noticed that 140208 is today's Date and After the - Last 3 digits are number.
Now what I want is, lets say If i save 87 Records today it should be 140208-087 and next day (tomorrow) numbers should be like 150208-001, 150208-002 etc.....
Please let me know if it possible then how? I m using the following code for Auto Generation of the Number but in different format.
=========My Code Goes Here =========
Dim C, E As String
Dim D As Integer
C = "ABCDEF"
If Xrs.RecordCount = 0 Then
D = 1
Do While Not Xrs.EOF
If Xrs("QNo") > D Then
End If
Xrs.MoveNext
D = D + 1
Loop
If D >= 1 And D < 10 Then
E = C & "0000" & D
Text1.Text = E
Else
If D >= 10 And D < 100 Then
E = C & "000" & D
Text1.Text = E
Else
If D >= 100 And D < 1000 Then
E = C & "00" & D
Text1.Text = E
Else
If D >= 1000 And D < 10000 Then
E = C & "0" & D
Text1.Text = E
Else
E = C & D
Text1.Text = E
End If
End If
End If
End If
Xrs.AddNew
Xrs("QNo").Valu e = E
Text1.Text = Xrs.Fields("QNo ")
====== Code Ends Here ===========
Regards,
Hiren
VB 6.0 and MS Access
While Saving Record, I want Number to be Generated in following Format
140208-001, 140208-002, 140208-003 . . . etc...
You must have noticed that 140208 is today's Date and After the - Last 3 digits are number.
Now what I want is, lets say If i save 87 Records today it should be 140208-087 and next day (tomorrow) numbers should be like 150208-001, 150208-002 etc.....
Please let me know if it possible then how? I m using the following code for Auto Generation of the Number but in different format.
=========My Code Goes Here =========
Dim C, E As String
Dim D As Integer
C = "ABCDEF"
If Xrs.RecordCount = 0 Then
D = 1
Do While Not Xrs.EOF
If Xrs("QNo") > D Then
End If
Xrs.MoveNext
D = D + 1
Loop
If D >= 1 And D < 10 Then
E = C & "0000" & D
Text1.Text = E
Else
If D >= 10 And D < 100 Then
E = C & "000" & D
Text1.Text = E
Else
If D >= 100 And D < 1000 Then
E = C & "00" & D
Text1.Text = E
Else
If D >= 1000 And D < 10000 Then
E = C & "0" & D
Text1.Text = E
Else
E = C & D
Text1.Text = E
End If
End If
End If
End If
Xrs.AddNew
Xrs("QNo").Valu e = E
Text1.Text = Xrs.Fields("QNo ")
====== Code Ends Here ===========
Regards,
Hiren
Comment