472,143 Members | 1,248 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

File Name Increment.....0001.tif, 0002.tif

Here is a something I used recently to increment job numbers for a
company. Create counter table with one integer filed (i.e.
tblCounter). Create a single record with the starting value (in you
case 001). Then, all you have to do is use the Dmax function to grab
the last value and after that value is used, apply code to insert a
record creating the next available number. Here is the code:

Private Sub Combo23_AfterUpdate()
Dim intLastType3 As Integer
Dim intLastType2 As Integer
Dim dtYear2 As Variant
Dim dtYear3 As Variant
Dim strType2 As String
Dim strType3 As String

intLastType2 = (DMax("SiteCounter", "tblCounterType1"))
intLastType3 = (DMax("MaterialCounter", "tblCounterType3"))
dtYear2 = Format(Now, "YY")
dtYear3 = Format(Now, "YY")

Select Case Me.Combo23.Text
Case "Furnish & Install Track Builder"
DoCmd.OpenForm "frmAssignJobNum_TrackBuilder"
Case "Furnish & Install Site Specific"
strType2 = intLastType2 & "-" & dtYear2
Me.txtJobNumber = strType2
Dim Db As Database, rs As Recordset
Set Db = CurrentDb()
Set rs = Db.openrecordset("tblCounterType1")
rs!SiteCounter = intLastType2 + 1
MsgBox "The new Job# has been recorded", vbInformation, "Tech-con
Job Log"
Case "Furnish (Material Only)"
strType3 = "$$" & intLastType3 & "-" & dtYear3
Me.txtJobNumber = strType3
Set Db = CurrentDb()
Set rs = Db.openrecordset("tblCounterType3")
rs!MaterialCounter = intLastType3 + 1
MsgBox "The new Job# has been recorded", vbInformation, "Tech-con
Job Log"

End Select
End Sub



pa********@hotmail.com (PaulMac) wrote in message news:<1e**************************@posting.google. com>...
Thanks Rick,

Could you please post the Dir() code that you use.


Nov 12 '05 #1
0 1639

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by linda.h.jackson | last post: by
6 posts views Thread by luanhoxung | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.