dbTalk Databases Forums  

Invoke color picker in code with Access 2003?

comp.databases.ms-access comp.databases.ms-access


Discuss Invoke color picker in code with Access 2003? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PW
 
Posts: n/a

Default Invoke color picker in code with Access 2003? - 04-22-2009 , 11:27 AM






Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-22-2009 , 01:30 PM






PW wrote:

Quote:
Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw
This might help
http://www.mvps.org/access/api/api0060.htm


Reply With Quote
  #3  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-22-2009 , 02:38 PM



On Wed, 22 Apr 2009 11:30:59 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:

Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

This might help
http://www.mvps.org/access/api/api0060.htm
Looks good Salad! Mucho

-pw


Reply With Quote
  #4  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-22-2009 , 06:53 PM



On Wed, 22 Apr 2009 11:30:59 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:

Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

This might help
http://www.mvps.org/access/api/api0060.htm

Where do I put this code? I put everything below it in a module.

Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type


Reply With Quote
  #5  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-22-2009 , 06:54 PM



On Wed, 22 Apr 2009 11:30:59 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:

Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

This might help
http://www.mvps.org/access/api/api0060.htm
where do I put this code? I put everything below it in a module:

Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type


Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-22-2009 , 10:33 PM



PW wrote:

Quote:
On Wed, 22 Apr 2009 11:30:59 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:


PW wrote:


Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

This might help
http://www.mvps.org/access/api/api0060.htm


where do I put this code? I put everything below it in a module:

Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
I'd put the whole thing, not just the type declaration, from that link
into a code module (under Modules)

You might want to download the zip file.

In your form, you'd call the funtion similar to
Private Sub CmdChooseBackColor_Click()
' Pass the TextBox Control to the function
Me.textCtl.BackColor = DialogColor(Me.textCtl)
End Sub


Reply With Quote
  #7  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 11:20 AM



On Wed, 22 Apr 2009 20:33:01 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:

On Wed, 22 Apr 2009 11:30:59 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:


PW wrote:


Hi,

Is it possible to bring up the color picker using code in Access 2003
and return the RGB or color value? I'd like the user to be able to
choose form background color, etc....

-paulw

This might help
http://www.mvps.org/access/api/api0060.htm


where do I put this code? I put everything below it in a module:

Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

I'd put the whole thing, not just the type declaration, from that link
into a code module (under Modules)
But Access puts no automatic "seperation" (line) before and after it
like it does with functions.

Quote:
You might want to download the zip file.
I did but there is no design rights so I can't look at the code (I've
tried using the default system.mdw workgroup)

Quote:
In your form, you'd call the funtion similar to
Private Sub CmdChooseBackColor_Click()
' Pass the TextBox Control to the function
Me.textCtl.BackColor = DialogColor(Me.textCtl)
End Sub
Thanks!


Reply With Quote
  #8  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 11:47 AM



Nevermind! I converted it to 2003 and I can look at the code. Thanks
again.

-pw

Reply With Quote
  #9  
Old   
Salad
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 01:56 PM



PW wrote:
Quote:
Nevermind! I converted it to 2003 and I can look at the code. Thanks
again.

-pw
You're welcome. It seems to work just fine.


Reply With Quote
  #10  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 04:59 PM



On Thu, 23 Apr 2009 11:56:27 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:
Nevermind! I converted it to 2003 and I can look at the code. Thanks
again.

-pw

You're welcome. It seems to work just fine.
I'm struggling a little bit with the instructions on how to return a
value to the form so I can change the RGB colors of controls. Don't
quite understand what the function is supposed to contain:


' If you want this Function to simply Return
' the Value of the Color the user selected
' from the Dialog just change the Function
' Declaration in modColorPicker to something like:
'Public Function DialogColor(ctl As Control) As Long
' Remember to add the line of code at the
' end of the Function
'DialogColor = CS.rgbResult



' Then call it from your Form with code like:

'***Code Start
'Private Sub CmdChooseBackColor_Click()
' Pass the TextBox Control to the function
'Me.textCtl.BackColor = DialogColor(Me.textCtl)
'End Sub


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.