Solved

In English Please?!

Posted on 2009-03-30
3
164 Views
Last Modified: 2012-05-06
Hi guys,

Can someone comment this thoroughly please - I'm a new admin picking up old code :(

500 easy ones.
if len(strjob)>62 then

			

			val=instr(strJob, " - ")

			if val > 2 then strJob=left(strJob, val-1)

		end if

		val=instr(strJob, "-")

		if val > 0 then

			if mid(strJob,1,val-2) = mid(strJob,val+2,len(strJob)) then	strJob=mid(strJob,1,val-2)

		end if

Open in new window

0
Comment
Question by:Pearl_export_ben
3 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 24018252
Inst function
http://msdn.microsoft.com/en-us/library/8460tsh1(VS.80).aspx

Mid Function (Visual Basic)  
http://msdn.microsoft.com/en-us/library/05e63829(VS.80).aspx

Left function
http://msdn.microsoft.com/en-us/library/y050k1wb(VS.80).aspx
' check if the length of the string in strJob is longer than 62 charachters

if len(strjob)>62 then

  ' search the position of " - "

  val=instr(strJob, " - ")

  '  if position  is greather than 2, then take only the characters left from the string " - "

  if val > 2 then 

       strJob=left(strJob, val-1)

  end if

 ' search the position of "-"

  val=instr(strJob, "-")

  if val > 0 then

   '  if position  is greather than 0

     if mid(strJob,1,val-2) = mid(strJob,val+2,len(strJob)) then	

          strJob=mid(strJob,1,val-2)

   end if

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24018295
When you get the chance, change the name of the variable 'val'. Val is a function name. It extracts a numerical value from the left hand of a String.
0
 
LVL 8

Author Closing Comment

by:Pearl_export_ben
ID: 31564297
Fantastic - commented thoroughly and quickly as requested, thankyou :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now