kiwijules0505
Registered User.
- Local time
- Tomorrow, 02:08
- Joined
- Nov 27, 2007
- Messages
- 10
Hi All,
I've got the Function below set-up to assign standardised names to cutomers whose names may have multiple different formats, e.g. Fonterra Ltd, Fonterra Limited, etc. The funtion is called from an Access Query.
While this solution is working fine, I would like to rather have this look-up data reside in a table, which will be easier for the end user to update than this function.
The table will have two fields:
SEARCHSTRING
STANDARDISEDNAME
I think that the solution may look something like this, but not sure at all:
Can anyone point this newbie in the right direction please?
Thanks
I've got the Function below set-up to assign standardised names to cutomers whose names may have multiple different formats, e.g. Fonterra Ltd, Fonterra Limited, etc. The funtion is called from an Access Query.
Code:
Option Compare Database
Function Customertype(CUSTOMERNAME As Variant) As Variant
Dim x
If [CUSTOMERNAME] Like "*FONTERRA*" Then
x = "Fonterra"
ElseIf [CUSTOMERNAME] Like "*Anchor*" Then
x = "Fonterra"
ElseIf [CUSTOMERNAME] Like "*Alliance*" Then
x = "Alliance"
ElseIf [CUSTOMERNAME] Like "*Dongwha*" Then
x = "Dongwha"
End If
Customertype = x
End Function
While this solution is working fine, I would like to rather have this look-up data reside in a table, which will be easier for the end user to update than this function.
The table will have two fields:
SEARCHSTRING
STANDARDISEDNAME
I think that the solution may look something like this, but not sure at all:
Code:
For i = 1 To lastRow
If DATA.CUSTOMERNAME Like LOOKUPTABLE.SEARCHSTRING Then
x = LOOKUPTABLE. STANDARDISEDNAME
End If
Next i
Can anyone point this newbie in the right direction please?
Thanks