Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you automatically increment new form numbering in mdi

Status
Not open for further replies.

talidyce

Technical User
Mar 16, 2001
10
AU
Hello Folks!
I would like to increment the forms numbers on my MDI like in word new docs.
Can anybody help please?
Thank you.
 
This is a good case for using a global variable. You do this by adding a Public variable of type Long to a module (.bas). You'd increment it every time you needed a new document number. This is easy to do, but not that safe.

A good balance between ease of coding and safety is using a Private variable in your module, then writing a function to increment the value and return you the new value:
[tt]
Private m_NewDocNum as Long

Public Function GetNewDocNum() as Long
[tab]m_NewDocNum = m_NewDocNum + 1
[tab]GetNewDocNum = m_NewDocNum
End Function
[/tt]

If you want to get fancy, you'd use a class and the Singleton design pattern.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top