Solved

In English Please?!

Posted on 2009-03-30
3
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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