Syntax error (comma) in query expression (1 Viewer)

rsalinas

New member
Local time
Today, 11:30
Joined
Aug 1, 2013
Messages
1
Hi, I am new with Access and receive the following message after trying to run a query:
Syntax error (comma) in query expression, followed by the formula I wrote on the Query Builder. I use 4 tables to run the query, but only need to trim some stuff from one of them. This table is called BD_lamosa_corregida and have already selected Expression on the Total row in Design View. This is the formula:

parte: Trim(IIf(IIf(IsError(InStr(1,[Parte],"(",1)),"",InStr(1,[Parte],"(",1))="",[Parte],Left([Parte],IIf(IsError(InStr(1,[Parte],"(",1)),"",InStr(1,[Parte],"(",1))-1)))

The formula is trying to trim the left side of an expression (Part description) which may contain a code number in parenthesis or not, it might also have this parenthesis separated by a space or not.

Any help is well appreciated. Thanks
 

Mihail

Registered User.
Local time
Today, 19:30
Joined
Jan 22, 2011
Messages
2,373
Design a Public Function in a regular module:
Code:
Public Function fncTrim(strParte As String) As String
  'Here is code in order to this function to return the necessary (trimed) string
End Function
Apply this function
Code:
FieldName:fncTrim([Parte])
from your query.

Note please that I don't use for the new field the same name "parte:"
 

Users who are viewing this thread

Top Bottom