MVP Websites

G

Guest

I have been through many posts and been doing some research with very useful
functions that many of the MVP's have recommended various websites. However
I have not found the mother load yet concerning working examples of the
following functions listed below: that have been answered in this form...Some
explained...Other useful or common fuctions just solutions given.

Following Functions:

Trim
Left
Right
Instr
Split.

I see these functions used alot for solutions of extracting or returning
values. Where it gets confusing is when you start combining them togeather.

Question: Where can you find examples of these functions and combinations
of them being used. I know it depends on what your working on, However; I
seem to learn a great deal by looking at the syntax as the MVP's pick the
code apart in there genourous solutions. Thanks All for solving the many
mysteries of strings and values we throw out to you on a constant basis.
 
R

Rick Brandt

BrianPaul said:
I have been through many posts and been doing some research with very
useful functions that many of the MVP's have recommended various
websites. However I have not found the mother load yet concerning
working examples of the following functions listed below: that have
been answered in this form...Some explained...Other useful or common
fuctions just solutions given.

Following Functions:

Trim
Left
Right
Instr
Split.

I see these functions used alot for solutions of extracting or
returning values. Where it gets confusing is when you start
combining them togeather.

Question: Where can you find examples of these functions and
combinations of them being used. I know it depends on what your
working on, However; I seem to learn a great deal by looking at the
syntax as the MVP's pick the code apart in there genourous solutions.
Thanks All for solving the many mysteries of strings and values we
throw out to you on a constant basis.

Sorry, but as those are some of the simplest and most basic functions used in
Access and VBA code you are not likely to find too many examples on FAQ pages.
The help file and a good Access book are your best bets here.

When working on complex expressions that combine multiple functions you just
need to break them done so you can determine what each individual function
requires to work properly.
 
A

Arvin Meyer [MVP]

OK, here ya go:

Trim - Strips a space character(s), Chr(32), from a string. LTrim, Trims
only the left character(s), RTrim only the right characters. Trim does both
ends.

Left - Counts characters from the left side of a string. Thus
Left([MyField], 3) returns the left 3 characters.

Right - Counts characters from the right side of a string. Thus
Right([MyField], 4) returns the right 4 characters.

Instr - Returns the position of characters anywhere in a second string,
thus:

Instr("v", "Arvin") returns 3

Split - I don't think I've ever used the Split function, but the help file
says: Returns a zero-based, one-dimensional array containing a specified
number of substrings.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
B

Brendan Reynolds

In VBA code you have the option of not combining (or 'nesting') the function
calls. Instead you can call each function separately, and assign the result
to a variable for later use. This can make your code easier to read and
maintain. For example, here are two ways of returning the characters to the
left of the first space in a string ...

Public Sub TestSub()

Const strcTest As String = "some text"

'use nested function calls ...
Debug.Print Left$(strcTest, InStr(1, strcTest, " ") - 1)

'avoid nested function calls ...
Dim lngPos As Long
lngPos = InStr(1, strcTest, " ") - 1
Debug.Print Left$(strcTest, lngPos)

End Sub

Sometimes you may have no practical option but to 'nest' function calls in
SQL or expressions, though. It gets easier with practise and experience.
 
A

Allen Browne

The basic syntax is given in the Access help file.

In any code window, type the function into your code, move the cursor into
the word you want help with, and press F1.

Split() is available in Access 2000 and later. The other 4 you asked about
are in any version.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top