L
Lee
Hi everyone,
Can any of you help advise me on how to overcome sorting
problems for the following?...
The names in a field (called VisitorName) do not conform
to any prescribed format but I'd like to be able to sort
the records by people's surname AND (if possible) by
their first Initial. eg if the following names are in
the field:
A SMITH
G ADAMS
A M WILSON
ANTHONY ADAMS
ANDY HANSON
I'd like them sorted to:
ANTHONY ADAMS
G ADAMS
ANDY HANSON
A SMITH
A M WILSON
I've had a stab at writing some code using the Mid$
function which I had as an Event Procedure within the
Name grouping section of the report (under the 'On
Format' event). This didn't do anything and as I'm
guessing how to write the code I'm frankly not surprised!
Can anyone advise on this? If not, do you know a website
or anywhere that might be able to help?
Below is an extract from my feeble attempt at sorting by
Surname :-(
Dim strName As String
strName = Me.VisitorName
If Mid$(strName, 2, 1) = " " Then
Me.OrderBy = Mid$(strName, 3)
ElseIf Mid$(strName, 3, 1) = " " Then
Me.OrderBy = Mid$(strName, 4)
Blah, blah....
TIA
Lee
Can any of you help advise me on how to overcome sorting
problems for the following?...
The names in a field (called VisitorName) do not conform
to any prescribed format but I'd like to be able to sort
the records by people's surname AND (if possible) by
their first Initial. eg if the following names are in
the field:
A SMITH
G ADAMS
A M WILSON
ANTHONY ADAMS
ANDY HANSON
I'd like them sorted to:
ANTHONY ADAMS
G ADAMS
ANDY HANSON
A SMITH
A M WILSON
I've had a stab at writing some code using the Mid$
function which I had as an Event Procedure within the
Name grouping section of the report (under the 'On
Format' event). This didn't do anything and as I'm
guessing how to write the code I'm frankly not surprised!
Can anyone advise on this? If not, do you know a website
or anywhere that might be able to help?
Below is an extract from my feeble attempt at sorting by
Surname :-(
Dim strName As String
strName = Me.VisitorName
If Mid$(strName, 2, 1) = " " Then
Me.OrderBy = Mid$(strName, 3)
ElseIf Mid$(strName, 3, 1) = " " Then
Me.OrderBy = Mid$(strName, 4)
Blah, blah....
TIA
Lee