Results 1 to 6 of 6
  1. #1
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16

    VBA code to make text box italic

    Hi, as a starting point I am trying to make the font of a text box 'Tenant Code' italic, but no joy with the below:

    Code:
    Sub taz()
    
    Forms!("Tenants").Controls("Tenant Code").FontItalic = True
    End Sub
    The error message is:


    Compile error: Type-declaration character does not match declared data typq

  2. #2
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Why are you doing it in VBA? If the control is on a form and you always want it Italic as your code suggests just use the properties on the control

  3. #3
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16
    Hi Ray,

    Thank you for your quick response, yes I know I can use just alter the propertysheet,
    but for my education why does the above code not function?

    Thank you

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Tariq - I think your syntax is not correct. Take a look at this page and see if it helps you to get it right.
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

  5. #5
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    I have to agree with Robeen the syntax looks off to me
    If its the current form use me.controlname.fontitalic = true

  6. #6
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16
    Thank you for your assistance. I have now rectified the syntax

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 04-20-2012, 08:13 AM
  2. Replies: 4
    Last Post: 01-25-2012, 04:38 AM
  3. SQL Code to Make Query / Report
    By agent- in forum Programming
    Replies: 10
    Last Post: 06-17-2011, 04:14 PM
  4. Make text click-able
    By Fifa in forum Access
    Replies: 5
    Last Post: 03-27-2011, 06:44 PM
  5. Code in combobox, code in text box
    By float in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums