Click to See Complete Forum and Search --> : Sendkeys Problem in Access 2003


mrdata
July 25th, 2005, 07:56 PM
Why do I get the page setup dialog box instead of the Print Dialog box when using the following in a Macro
Ctrl P on the keyboard gives me the Print Dialog this is supposed to be the Sendkeys command to do the same but I get Page Setup instead.
Any Ideas?

SendKeys "{^}P", False

olivthill
July 26th, 2005, 02:23 AM
You should write instead

SendKeys "^P"

The "{" and "}" characters are used when you want to have "^" instead of the ctrl key.

mrdata
July 26th, 2005, 04:07 AM
olivthill: I tried what you suggested but I still get Page Setup instead of Print Dialog.
This is crazy the keyboard combination of Ctrl +P gives the print Dialog.
Why won't this do the same?
Do you think it is a problem with Access 2003?

What is the correct Sendkeys command for Alt +F
Maybe if I drop the menu down then use the Sendkeys "^P"

I am starting to wonder if this is going to work at all.
Why can't they just give you a common dialog control in the toolbox.

Has anyone out there been successful in doing this?

Thanks
Charles

olivthill
July 26th, 2005, 05:15 AM
I have tried ^P, and ... it doesn't work.

So, I have followed your suggestion, i.e. accesing the menu with the alt key, which gives "SendKeys %FI, false" ("%"=Alt, "F"=File, "I"="Imprimer" in my French version, but in English, this might be "P" like "Print"), and... it works.

mrdata
July 26th, 2005, 04:42 PM
olivthill: Could you explain where I need to put this and how much of this line is the code and how much is not.

"SendKeys %FI, false" ("%"=Alt, "F"=File, "I"="Imprimer"

I could not get it to work


Thanks
Charles

olivthill
July 27th, 2005, 04:07 AM
My test was conducted with Microsoft Access 2000 under Windwos ME.

I have created a table.
I have created a report to list the content of my table. My report is called R_data1
I have created a Macro called M_sendkeys containing two lines:
OuvrirEtat (OpenReport with the name of my report is R_data1, and display before printing)
EnvoiTouches (SendKeys with %FI (I suppose it is rather %FP for you) and don't wait)
I launch the macro by selecting Tools/Macro in the menubar.