Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB 5 String Information

Status
Not open for further replies.

ninash

Technical User
Jul 6, 2001
163
0
0
GB
Can anyone tell me where I can get infromation concerning string controls for visual basic 5 eg length, character testing, character position in strings.
I am sorry this is a really basic question but I am a vb6 programmer and need to know something for a project I am doing where a vb6 command is not recognised.
 
VB 5 supports the same string handling functions as VB 6, so they should not be causing a problem. perhaps it would be easier to answer this question if you could let us know which VB 6 function is failing.
 
I am using instr() to return the location of a space in a string.
This works fine when run in access 2000 but fails in access 97. I have removed the function in the access 97 db and all is fine except the code no longer does what I want it to do
 
This is the code I am using
Sorry again that it is basic I am really just getting to grips with it

Private Sub Surveyor_LostFocus()

Dim SpaceLocation
Dim StringLength
Dim FirstName
Dim Lastname

SpaceLocation = InStrRev([Surveyor], " ")
StringLength = Len(Surveyor)
FirstName = Left([Surveyor], SpaceLocation)
Lastname = Right([Surveyor], StringLength - SpaceLocation)

Me![test] = [property ID] & "-" & Left(FirstName, 1) & Left(Lastname, 1) & "-" & _
Format$(Day([Date]), dd) & Month([Date]) & Year([Date])

If IsNull([Survey ID]) Then
[Survey ID] = Me![test]
End If

End Sub
 
Someone already pointed this out in another post

replace InStrRev with plain old InStr
 
Sorry I forgot to mension I found this typo

Thanks for all that have help in solving this little problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top