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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Expression Cutoff in control source

Status
Not open for further replies.

mbaddar

Programmer
May 10, 2001
120
US
Hi,

I have a very long string expression in the control source property of a field in my report. In this string expression I'm trying to send the values from 30 fields to a function. The function is comparing the first value ("Message1") against the second value "Message2." If there is a difference between the two an asterik is printed in a textbox.

There are 30 messages that I'm comparing and all the way through Message28 this works perfectly. However, when I add 29 and 30 and I run the report, this part of the string gets removed from the control source. I'm assuming the string is too long. If I can't shorten it is there any other option? I don't think I can set the control source in code. Is there anything else I can do?

Thanks a ton for any help.

Mbaddar
 
How many characters make up the control? You can check by making another control that has this as a control source.

=Len(ControlToCheck)

If it's getting cut at 255 over and over, then that is your problem. You have a field which is crossing the gap from text to memo. And we need to look at another way to accomplish what you're doing.

HTH Joe Miller
joe.miller@flotech.net
 
After looking at your post again, another way to do what you want is to concatenate in pieces. I don't know if access has a limit to a control source (never wanted to test that one) but if it does then that makes sense why you are seeing what you are. You could do the following to make your complete control (I'm going to do 9 pieces instead of thirty for brevity's sake):

HiddenControl1
ControlSource: =MyField1 & MyField2 & MyField3

HiddenControl2
ControlSource: =MyField4 & MyField5 & MyField6

HiddenControl3
ControlSource: =MyField7 & MyField8 & MyField9

VisibleControlCombiningPiecesWithFinalAnswer!
(whew! long control name)
ControlSource: =HiddenControl1 & HiddenControl2 & HiddenControl3

HTH Joe Miller
joe.miller@flotech.net
 
Hi Joe,

I tried your suggestion and it makes sense to me but I keep getting an error message that I'm sending the wrong number of arguments to the function. My function (MessageAsterik) expects 30 arguments. I'm concatenating the hidden controls into one control like this:

=MessageAsterik([Hidden] & [Hidden1])
Hidden is taking 14 message fields and Hidden1 the other 16. When I try to send these to my function I'm getting the error message, "Wrong number of arguments."

Any ideas?

Thanks,
MBaddar
 
Sounds like your function MessageAsterik() is not getting all that it desires for input. You may have to modify your function to suit the new number of data fields you're feeding it now that it's less.

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top