473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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.AddNew
rs!SiteCounter = intLastType2 + 1
rs.Update
rs.Close
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.AddNew
rs!MaterialCounter = intLastType3 + 1
rs.Update
rs.Close
MsgBox "The new Job# has been recorded", vbInformation, "Tech-con
Job Log"

End Select
End Sub

HTH

Jason

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

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

thanks,
Paul

Nov 12 '05 #1
0 1697

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Kevin Knorpp | last post by:
Hello. I need to be able to extract the data from the attached file (or any file in the same format) so that I can work with the data in PHP. I'm fairly comfortable with using PHP with...
0
by: Jason Smith | last post by:
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...
1
by: linda.h.jackson | last post by:
Hi, I have a field in a table that needs to be automatically incremented but the number is non-standard. There is already existing data in the table but for future records, I need a certain...
2
by: jkflens | last post by:
Hello, i convert one XML-document by using XSLT into another XML-document. First change all attributes to elements is no problem. Then i try to insert a new element into the new document by...
2
by: Antonio-F100 | last post by:
Hello, I need help creating the code for a macro button on a form that will open a file directory with windows explorer. I have about 500 directories with very long names and only want to...
1
Cyberdyne
by: Cyberdyne | last post by:
Hi Guys I am working on a database that will have a locked auto field with the following characteristics. It has to be a number that will be stored in a table, it needs to have the following format ...
2
by: zmann1976 | last post by:
Hi all this is my first post and I’m sorry I’m a noob. I’ve been working on this for a couple of days and I cant seem to get it. I’m very sure that this is probably a very simple problem but it...
6
by: luanhoxung | last post by:
hi all ! I have a text field with contruction: 0001-COM. I need to it automatically increase 0002-COM when add new record and ..... Any help with appreciated. Luan
1
by: Chithra Anoop | last post by:
I want to create files with different names in c#. It should be in the form 0001.9001 0001.9002 0001.9003 0001.9004 0001.9005 0002.9001 0002.9002 0002.9003 0002.9004 0002.9005
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.