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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Script to Create New Account #

Status
Not open for further replies.

SeaninSeattle

IS-IT--Management
Sep 17, 2001
53
US
We're using Great Plains eEnterprise, and I want to create an auto-numbering account number creator in VBA.

I want to write a VBA bit that will go to a specified text file, take the number contained in it, use it for the account number, then write back that number to the file, plus one.

Basically, it will be a sequential numbering system. Anyone have any handy ideas on where I start?

Thanks,
//sse

Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
How is the text file set up? Is there only one item or will the last number be at the bottom of the list? How big are the numbers?
Code:
Sub GetNextAcctNo()
    Dim lAcctNo As Long
    Dim sFile As String

    sFile = "C:\Temp\YourFile.txt"

    Open sFile For Input As #1
        Input #1, lAcctNo
    Close #1

    lAcctNo = lAcctNo + 1

    Open sFile For Output As #1
        Print #1, lAcctNo
    Close #1

    MsgBox "New Acct. No: " & lAcctNo
End Sub
 
Hey - thanks.

Only one number on the text message - and let's say six digits... Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top