Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sequential Record ID for Excel Template

Hi, I hope somebody can help me
I am trying to create a template that will allow me to record a unique Record ID for each form generated from the template. (Kind of like an invoice number
Any Ideas

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Sequential Record ID for Excel Template

Sean

The way that I do this is store the last invoice number used in a text file.
Then when I want a new invoice number, my code retrieves the number,
increments it by one and writes the new number back to the text file.

If more than one person uses the template, you could have a problem where
they both get the old number before the new one is written. I'm the only
one that uses mine, so I haven't looked into how to prevent that. Here's
the code that I use:

Sub NextInv()

Dim FName As String
Dim FNum As Long
Dim LstInv As String

FName = "\\Server1\c\Paragon\Policies & Forms\LastInv.txt"
FNum = FreeFile

Open FName For Input As FNum
Input #FNum, LstInv

Close FNum

Range("B18").Value = CLng(LstInv) + 1

Open FName For Output As FNum
Print #FNum, CLng(LstInv) + 1
Close FNum

Sheet1.Shapes("Button 1").Visible = False

Range("g10").Select

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Sean Reilly" wrote in message
...
Hi, I hope somebody can help me.
I am trying to create a template that will allow me to record a unique

Record ID for each form generated from the template. (Kind of like an
invoice number)
Any Ideas?

Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Template problem - update existing record [email protected] Excel Discussion (Misc queries) 0 January 26th 07 11:34 AM
Using Student Attendance Record template in Excel 2003 frazzledteacher Excel Worksheet Functions 0 September 2nd 05 04:41 AM
Template for Excel to keep running record? Will Sutton Excel Discussion (Misc queries) 0 June 28th 05 10:28 PM
How do I assign sequential numbers in an Excel 2003 PO template? skiusa Excel Worksheet Functions 1 March 28th 05 10:57 PM
How do I save a record from an excel template to a database in a . Fred Smith Excel Discussion (Misc queries) 1 November 30th 04 01:49 PM


All times are GMT +1. The time now is 03:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"