Lotus script

I have a Helpdesk DB when a case is raised a case number is assigned automatically from a network file. I have not found any way to make it auto via script only. Now some times when network is slow or due to time out the auto number is not picked when a new case is raised.I want either the field be made in such way that it has to wait unless the number is picked or to be automated via lotus script so i may not need the network file. I have pasted the script here. Please help.

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Dim fileNum As Integer
      Dim fileName As String
      Dim NrCrt As Long
      Dim NewNrCrt As Long
      fileNum% = Freefile()
      fileName$ = "\\server\uniqueNo\SRegNo.txt" 'This is the path to the file that keeps the current number
 'If is new doc assign a new number
      If source.IsNewDoc Then
 'Open for reading the file, read the value then close the file
            Open fileName$ For Input Lock Read Write As fileNum% '
            Input #fileNum%,NrCrt
            Close fileNum%
            NewNrCrt=NrCrt+1 'Increment the value
 'Open for writing the file, write the value then close the file
            Open fileName$ For Output Lock Read Write As fileNum%
            Write #fileNum%,NewNrCrt
            Close fileNum%
            If Isnull(NewNrCrt) Then
                  Msgbox("Can't generate the registration number ! Please check the path to the file: " & fileName$ )
            End If
            If Source.FieldGetText("Department")="" Then
                  Msgbox "Please enter the required values such as Department and phone number"
                  Exit Sub
            End If
            Call source.FieldSetText("sRegNo","ITHELP-" & Str$(NewNrCrt)) 'Complete the current number in the form
      End If
End Sub


Find Your Answer,
Ask the Experts.

Start your free trial

Free 30 day trial of a Premium Membership. Cancel anytime.

What's a Premium Membership?

Download the Experts Exchange Guide

Consulting & Contracting:
How to Go Out On Your Own

Can you become an independent contractor with your own business?

We will never share this with anyone.

Skill Training Video TutorialsExpand your tech skills quickly with five-minute, instructional videos.

See More Software Videos

What does a Premium Membership get you?

  • Unlimited Access to over 4 million verified technology solutions

  • Unlimited Access to thousands of interactive articles and videos

  • Unlimited technical writing assistance

  • Submit your projects for Expert Testing

  • Expand your professional network with our messaging and hire me features

  • Ad free and mobile optimized experience

Join the Network Today!

See Plans and Pricing