Jumat, 08 Maret 2019

Re: [MS_AccessPros] Converting String to Hex

 

Dear Crystal,

Thanks a lot. I am trying to build a color scheme database myself.

Best Regards,

Kevin

On 08-Mar-2019 4:41 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] wrote:
 

hi Kevin,

BackColor will never be Null. BackStyle might be Transparent (0) -- Normal is 1.

You can also set Color using RGB (Red, Green, Blue) like this:

..BackColor = RGB( 255, 255, 255) 'white

To answer your question though, you can preface with &H and use CLng to convert to Long.
psHex is a string with a Hex code:

'~~~~~~~~~~~~~~~~~

Function GetDecFromHex(psHex As String) As Long
's4p
If InStr(psHex, "&H") = 0 Then
GetDecFromHex = CLng("&H" & psHex)
Else
GetDecFromHex = CLng(psHex)
End If
End Function
'~~~~~~~~~~~~~~~~~

have an awesome day,
crystal

On 3/8/2019 1:50 AM, Kevin qingqinga@yahoo.com [MS_Access_Professionals]
wrote:
> Dear All,
>
> Is it possible to convert color string into hex? So that I can apply it
> in code to customize the color of forms? Thanks in advance.
>
> I expect to get this result:
>
> Me.Color.BackColor=IIf(IsNull(Me.ColorCode),Color_Hex_To_Long("#FFFFFF"),Color_Hex_To_Long(Me.ColorCode))
>
>
> Best Regards,
>
> Kevin
>
>
>
> ------------------------------------
> Posted by: Kevin <qingqinga@yahoo.com>
> ------------------------------------
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>

__._,_.___

Posted by: Kevin <qingqinga@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar