Solved

Access 2010 VBA: Looked all over but can't find straight answer for how to set color property of field using, #NNNNNN format

Posted on 2012-03-13
3
627 Views
Last Modified: 2012-03-14
Background:

I have this VBA statement

Form_Storage_Automation_Main_Form.HBA1.BackColor = "#F8F8F8"

I'm getting a "Type Mismatch" error.

I've looked through many online blogs and forums without success. The approach above I got out of a VB example. Is there a difference in VBA?

I don't understand what even the type would be?

What would be the correct way to do this?
0
Comment
Question by:stuckp1
3 Comments
 
LVL 70

Expert Comment

by:KCTS
ID: 37717412
get rid of the quotes
0
 
LVL 12

Accepted Solution

by:
danishani earned 250 total points
ID: 37717564
Form_Storage_Automation_Main_Form.HBA1.BackColor = &HF8F8F8

You can also use a HexColor Function as well, you can find in below thread:
http://blogs.office.com/b/microsoft-access/archive/2009/10/26/convert-hexadecimal-color-codes-so-you-can-use-them-in-code.aspx


Hope this helps,
Daniel
0
 

Author Closing Comment

by:stuckp1
ID: 37721722
The removal of quotes didn't work for me, but Daniel's example did work.
What also works is to use MSAccess
Form_Storage_Automation_Main_Form.Snapshot_Quantity.BackColor = 11908533

See http://www.endprod.com/colors/

Again, thanks to everyone.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question