Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this function?

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
In a report, I used the following function/formula to group records using group field name mius 4 initial letters.

= Right([FieldName], Len([Fieldname], -4)

I added this to the record source of the field.

I could successfully pull report up until now. But now there is an error when I open the report asking to indicate parameter value for 'Right'. I keep wondering what could have gone wrong. I have not amended this report for some time and I just don't unbderstand why can't I have this function. Even aftetr deleting and re entrering the formula, I confront the message that the expression you entered contains invalid syntax, or you need to enclose your text data in quotes.

Could someone shed some light on this?

Cheers

AK
 
Hi,
Can you try this code instead?

fldName = Left(fldName, Len(fldName) - 4) HTH, [pc2]
Randy Smith
California Teachers Association
 
Thanks Randy. It still comes back with error message :

Syntax query in Query Expression '(First([ST= Right([ST], Len([ST])-1)).

ST is the name of my field. Please note that this is basically an expression which converts a value in my query using following formula.

ST: IIf([StoreType]="Supermarket","1 - Supermarkets","")))

I did not mention this before as I thought this might not be relevant but looking at the error message with a 'First' in the begining , I am suspecting this may have something to do with the underlying query.

Cheers

AK
 
Hi,
I am really confused by your code statement:
(First([ST= Right([ST], Len([ST])-1) HTH, [pc2]
Randy Smith
California Teachers Association
 
Randy

I merely tried to clarify the statement I was using, I am not using the code which has been returned by error message or you are referring to.

All I am trying to do is to use a field in my underlying query (which indicates whether it is supermarket or a liquor store) and concatenate it with a prefix '1-' to supermarket and '2-' to a liquor store. Prefixing the store type helps me to ensure Supermarkets appear first in the report. And in the report I used the formula =Right([StoreType], Len([StoreType])-1) to get rid of prefixes in the printed repiort. This worked very well all this while but now I get the error message when I run the report prompting me with a paramater box for 'Right'. Sorry for confusing you by not giving full details earlier.

Cheers

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top