silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys,
I am stuck with an update query which gives me an error datatype issue.
I have created a custom function to update phonenumbers
A update Query with following syntax
The field kunTelefon is a string DataType
Why do I get this error? Can anyone please help with this problem?
As always much appreciated!
I am stuck with an update query which gives me an error datatype issue.
I have created a custom function to update phonenumbers
Code:
Function TelefonUpdate(ByVal strText As String) As String
Select Case True
Case strText Like "0*#"
If strText Like "0####/#*#" Then
TelefonUpdate = Replace(strText, "/", " ", 1, 1)
ElseIf strText Like "0####-#*#" Then
TelefonUpdate = Replace(strText, "-", " ", 1, 1)
ElseIf strText Like "0 ## ##/#*#" Then
TelefonUpdate = Replace(strText, " ", "", 1, 2)
ElseIf strText Like "004#/###/#*#" Then
TelefonUpdate = Replace(strText, "/", " ", 1, 2)
End If
Case strText Like "+##*"
If strText Like "+4# ### / #*" Then
TelefonUpdate = Replace(strText, " / ", " ", 1, 1)
ElseIf strText Like "+4#/####/#*#" Then
TelefonUpdate = Replace(strText, "/", " ", 1, 2)
ElseIf strText Like "+4# (0) #*#" Then
TelefonUpdate = Replace(strText, "(0)", "", 1, 1)
ElseIf strText Like "+4# (0)####/#*#" Then
TelefonUpdate = Replace(strText, "(0)", "", 1, 1)
End If
Case Else
TelefonUpdate = strText
End Select
End Function
A update Query with following syntax
Code:
UPDATE tblKunden SET tblKunden.kunTelefon = TelefonUpdate([kunTelefon]);
The field kunTelefon is a string DataType
Why do I get this error? Can anyone please help with this problem?
As always much appreciated!