I changed up your code to work with the project table. This is what I have so far, but I'm having trouble telling it what the last project ID was so it can then increment. I might be going about it wrong, I'm fairly new to this still. Thanks for the help.
Private Function GetNextKey() As String
'//Use the company Adapter to Store our sequance number Number01
Dim edvProject As epiDataView = Ctype(oTrans.EpiDataViews("Project"), EpiDataView)
Dim nextKey As String = String.Empty
Dim projectAdapter As ProjectAdapter = New ProjectAdapter(ProjectEntryForm)Â
projectAdapter.BOConnect()
'Dim project As String = ProjectEntryForm.Session.CompanyID
'Dim project As String = edvProject.dataView(edvProject.Row)("ProjectID")
'Dim found As Boolean = projectAdapter.GetByID(project)
Dim found As Boolean = False
Dim opts2 As New SearchOptions(Epicor.Mfg.UI.Searches.SearchMode.AutoSearch)
'set options for autosearch
opts2.DataSetMode = DataSetMode.ListDataSet
'opts2.PreLoadSearchFilter = "ProjectID = '" + sProjectID + "'"
'launch the autosearch
Dim callResult As Object = ProcessCaller.LaunchSearch(ProjectEntryForm, "ProjectAdapter", opts2)
'check if the projectID already existed
If(TypeOf callResult Is System.Data.DataSet) AndAlso (DirectCast(callResult, DataSet).Tables(0).Rows.Count > 0) Then
  found = True
Dim rowcount As Integer = callResult.Tables(0).Rows.Count
if (found) then
nextKey = projectAdapter.ProjectData.Project.Rows(rowcount)("ProjectID").toString()
projectAdapter.ProjectData.Project.Rows(0).BeginEdit()
projectAdapter.ProjectData.Project.Rows(0)("ProjectID") += 1
projectAdapter.ProjectData.Project.Rows(0).EndEdit()
projectAdapter.Update()
projectAdapter.Dispose()
end if
End If
'messagebox.show("nextKey = " & nextKey)
return nextKey
End Function
Private Sub edvProject_EpiViewNotification(ByVal view As EpiDataView, ByVal args As EpiNotifyArgs)
' ** Argument Properties and Uses **
' view.dataView(args.Row)("FieldName")
' args.Row, args.Column, args.Sender, args.NotifyType
' NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
If (args.Row > -1) Then
view.dataView(args.Row)("ProjectID") = GetNextKey
End If
End If
End Sub
________________________________
From: Ian <
ianwhardy@...>
To:
vantage@yahoogroups.com
Sent: Thursday, September 8, 2011 9:20 AM
Subject: [Vantage] Re: Automating Project ID creation
You can have it set when they click on new, using the following code. This is pulling the number saved in Company.Number02.
You'll have to change the UD10 table and form names to be the project ones though:
Private Function GetNextKey() As String
'//Use the company Adapter to Store our sequance number Number01
Dim nextKey As String = String.Empty
Dim companyAdapter As CompanyAdapter = New CompanyAdapter(UD10Form)
companyAdapter.BOConnect()
Dim company As String = UD10Form.Session.CompanyID
Dim found As Boolean = companyAdapter.GetByID(company)
if (found) then
nextKey = companyAdapter.CompanyData.Company.Rows(0)("Number05").toString()
companyAdapter.CompanyData.Company.Rows(0).BeginEdit()
companyAdapter.CompanyData.Company.Rows(0)("Number05") += 1
companyAdapter.CompanyData.Company.Rows(0).EndEdit()
companyAdapter.Update()
companyAdapter.Dispose()
end if
'messagebox.show("nextKey = " & nextKey)
return nextKey
End Function
   Private Sub edvUD10_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvUD10.EpiViewNotification
      '// ** Argument Properties and Uses **
      '// view.dataView(args.Row)("[FieldName]")
      '// args.Row, args.Column, args.Sender, args.NotifyType
      '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
      If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
         If (args.Row > -1) Then
     view.dataView(args.Row)("Key1") = GetNextKey
         End If
      End If
   End Sub
--- In vantage@yahoogroups.com, "tkoch77" <tkoch77@...> wrote:
>
> I am attempting to create a process that is similar to creating a purchase order or quote. I want when the person selects new project, the project ID field is read-only and after the user puts in a description and whatever other information they want and saves, a sequential project ID number is generated for the new project. Anyone have input on this, if that is a good idea and/or have attempted something similar.
>
> TIA
> Ted
>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note:Â You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.%c2%a0
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
[Non-text portions of this message have been removed]