Stephen LeCompte
asked on
How to fix color picker dialog box 32-bit code to work with 64-bit version of Access 2010?
Per following attachment - I have a color picker dialog box that comes up where you select a color and it changes the background form's color property.
It works great with Office 2007 32-bit but not at all with Office 2010 64-bit. Even when I remark out the 32-bit one (Private Declare Function mmChooseColor_API...) and replace with the 64-bit coding (Private Declare PtrSafe Function mmChooseColor_API...) , I still get a Type Mismatch error with the highlight on VarPtr?
Now it does work with Office 2010 32-bit but its just that the entire office where I work will upgrade to all Office 2010 64-bit.
I'm open to try another color picker function if someone has used and it works great in Office 2010 64-bit instead of this one provided...
Or if it can be solved as is then great. I really think its the MMCHOOSECOLOR being used in the Private Declare PtrSafe Function mmChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As MMCHOOSECOLOR) As Long since its a Private Type...but I don't know what syntax that needs to be arranged for it to allow through?
Color-Picker.accdb
Capture.PNG
Capture2.PNG
It works great with Office 2007 32-bit but not at all with Office 2010 64-bit. Even when I remark out the 32-bit one (Private Declare Function mmChooseColor_API...) and replace with the 64-bit coding (Private Declare PtrSafe Function mmChooseColor_API...) , I still get a Type Mismatch error with the highlight on VarPtr?
Now it does work with Office 2010 32-bit but its just that the entire office where I work will upgrade to all Office 2010 64-bit.
I'm open to try another color picker function if someone has used and it works great in Office 2010 64-bit instead of this one provided...
Or if it can be solved as is then great. I really think its the MMCHOOSECOLOR being used in the Private Declare PtrSafe Function mmChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As MMCHOOSECOLOR) As Long since its a Private Type...but I don't know what syntax that needs to be arranged for it to allow through?
Color-Picker.accdb
Capture.PNG
Capture2.PNG
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks boag.... having the other sample helps tremondously
Also, the idea of using to differently compiled front ends for both 32 and 64-bit guides me on a better path.
Thanks to all for your comments!
Also, the idea of using to differently compiled front ends for both 32 and 64-bit guides me on a better path.
Thanks to all for your comments!
ASKER
PtrSafe seems to be the magic fix when the situation is everyone has Office 2010 64-bit. But when I change the code to include PtrSafe it balks when the file is opened via Office 2007 32-bit. Even that link Compatibility Between the 32-bit and 64-bit versions link says it should work with both versions when you use #If vba7 then and it does but still balks at any mention of PtrSafe on the next line below.
Could someone take this sample make it work in Office 2010 64-bit and then try opening it only in Office 2007 32-bit and see this error? If no error, please let me know if I need to fix a reference problem on my end. In fact, provided the error has an image below:
IF there is no way that 64-bit code PtrSafe can work with 32-bit please let me know so I can close the question.
I would like to keep open for a week's time and if no one replies, I'll just accept DatabaseMX's comments as solution.
64-bit-code-in-32-only-access-20.png