Solved

In English Please?!

Posted on 2009-03-30
3
168 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

Suggested Solutions

Title # Comments Views Activity
Added a column screws up code 5 69
pop out of webbrowser1 control vba6 5 43
Automatic Email Reminder 4 73
which modules are active in VB6 project? 6 52
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

749 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