Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Concatenation error (Access 2000)

    I have a text box in my report called Text78.
    In the OnOpen event of the report i have the folowing code :

    Me![Text78].ControlSource = "students"

    I want to concatenate the control with the word "students"
    I have tried, but i ger the error Enter parameter value

    Can somebody help me where the error lies with the following concatenation, giving an error ?


    Me![Text78].ControlSource = "students" & " students"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Concatenation error (Access 2000)

    The resulting control source should look like this:

    <code>=[Students] & " students"</code>

    If you want to set this control source in code, you have a problem: the control source is a quoted string, but the stirng itself contains quotes. One solution is to double the quotes within the string:

    <code>Me![Text78].ControlSource = "=[Students] & "" students"""</code>

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Concatenation error (Access 2000)

    Thank you for your excellent suggestion. Where can i put this code? If i put in the OnOpen event, then i get the message
    "you entered an expression that has no value "
    If i put it in the Detail section, tin he On Format event, then i get the message
    you cant set the control source property after printing has started

    Cann i find a solution to this problem ?

    Best regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Concatenation error (Access 2000)

    In the first place, make sure that there is no typing error in your expression. I have often used code like this without problems.

    In the second place, why are you doing this in code? In most situations, you can set the control source in design view.

  5. #5
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Concatenation error (Access 2000)

    Dear Hans,

    i feel obliged to let you know that your suggestion works ! As always. I had a typing error and i corrected it now

    best regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •