Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Programming Conditional Formats (2003)

    I'm trying to programmatically format the Description text box on the FrmMag form of the attached frontend/backend mdb's but why, when you open the FDezzo form, do you get a 'Run-time error 13: Type mismatch'?
    Attached Files Attached Files

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

    Re: Programming Conditional Formats (2003)

    If you look up the help for the Add method of FormatConditions, you'll see that the second argument is the operator, and the expression the third argument. You've used the expression as second argument.

    Use either
    <code>
    Set frc1 = frm1.Controls("Description"). _
    FormatConditions.Add(acExpression, , "[FN]>0")
    </code>
    or use named arguments:
    <code>
    Set frc1 = frm1.Controls("Description"). _
    FormatConditions.Add(Type:=acExpression, Expression1:="[FN]>0")
    </code>
    and similar for the other instances of FormatConditions.Add, of course.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Programming Conditional Formats (2003)

    Thank you Hans <img src=/S/smile.gif border=0 alt=smile width=15 height=15>, if you open the FDezzo form and select 2nd July 2008 by double-clicking the combo box labelled "Not yet received", you can see that the Description text box on the FrmMag subform has a gray background only on the top row while it ought to be gray in all rows because the Visto check box is True for all four of them. How can I modify the code so as to correct this?
    Attached Files Attached Files

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

    Re: Programming Conditional Formats (2003)

    If I comment out PersistAConditionalFormat it seems to work OK.

    Keep in mind that the conditional formatting settings are the same for ALL records in a form. You cannot use the Form_Current event to specify different conditional formatting settings for different records.

    BTW I had to disable the Form_Load code for FDezzo - it made Access crash when I tried to open the form.

Posting Permissions

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