09. november 2001 - 09:28Der er
58 kommentarer og 1 løsning
udskriv - preferencer
Jeg har en udskriftsknap i en formular!
Hvordan får jeg denne til at spørge brugeren hvilken printer han/hun vil benytte. Altså ikke med en speciel msg box, bare windows standard for udskrift!
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
The DoCmd.OpenReport stDocName, acNormal prints the report on the current (default) printer. You could change the line to the following DoCmd.OpenReport stDocName, acPreview
And then pressing Ctrl+P shows the printer dialog wher eyou can change the default printer. Or you can sellect Print from the file menu. I call the function AppPrintOut in the answer I gave from a custom menu I use.
If i understand you and the code rigt, this i the way to create a preview, altso called \"Vis udskrift\" in danish - then the user have to press ctrl+P to print the page, are there no possibilities for print with the dialog directly from a botton
Yes \"Vis udskrift\" is correct. As far as I know, there isnt a way to choose another printer other than by opening the print dialog. The print dialog prints the object which has the focus. This means that if you are previewing a report but select a form (give it the focus) then the print dialog will print that (the form) and not your report. So the only way I can see is by pressing Ctrl+P or through the menu.
It is possible to use a specific printer with your report (Page setup) when the report is in design view. But this cant be changed (or not easily).
sorry - i have not explained my self. Den ovenstående kode udskriver en post i formularen - men for at den bliver udskrevet korrekt skal siden ligge ned, og af samme grund er det nødvendigt at brugeren kan vælge i printer dialog boxen!
Err_Command2_Click: \'Check whether the run command was canceled If Err.Number = 2501 Then Exit Function Else msgBox Err.Number & vbCrLf & Err.Description End If
Terry - jeg tror nok at jeg har forstået din pointe! Men hvordan får jeg den til at spørge efter hvordan jeg vil udskrive når jeg skal udskrive en formular
Problemet er dog bare at jeg skal have adgang til printerdialogen for at kunne udskrive horizontalt i stedet for vertikalt (du ved stående og liggende) desuden er jeg ikke interesseret i at fyre sådanne fomularudskrifter i hovedet af min store farveprinter - det er rigeligt med lidt s/h!
You can use the button wizard to print a form. In this example I have just replaced the DoCmd.PrintOut with DoCmd.RunCommand acCmdPrint DoCmd.PrintOut just prints the current object without opening the printer dialog, the Runcommand .... printe sthe current object opening the printer dialog
Private Sub Command38_Click() On Error GoTo Err_Command38_Click
11:40:58 Jeg har en formular der indeholder flere poster. Altså mange forskellige poster og jeg vil gerne kunne udskrive dem enkeltvis.
Jeg har således en knap på min formular som fungere som udskriftsknap, og den udskriver med din nyeste kode rigtig mange sider på én gang - her var det festligt om den kunne nøjes med den aktuelle post!
When you open the print dialog using DoCmd.RunCommand acCmdPrint you can choose what you want to print from there (all, pages or selected) and you can choose other paramteres such as landscape or portrait.
I think you will have to select \"selected\" manually. If you used the DoCmd.PrintOut method then you could set this in code but then you wouldnt be able to select landscape.
Why dont you set the page layout in the page setup menu and then use the DoCmd.PrintOut method?
Ja, ok - jeg får da udskriftsdialogen men det er ikke særlig heldigt at en hvilken som helst bruger kan komme til at sætte en udskrift i gang ag de sidste 1500 poster i databasen!
Er der ikke andre løsninger - der er jo ved at være en del point at hendte!
Have you added the sendkeys \"%r\"? Normally when the print dialog is opened then the All radio button is selected in the print range. The sendkeys \"%r\" selects the Selected Record(s) and it should be only one. Doesnt it just print the one record?
Th eproblem is that you wnat to let the user do some things but not others and this gives room for error. WHY CAN YOU NOT SELECT THE PRINTER AND PAGE LAYOUT FROM THE PAGE SETUP DIALOG?
About the sendkeys \"&r\" - yes i have tryed it, but i still got to count on the user, that he or she will remember to click in the \"selected\" button in the print dialog.
About the second question with the dialog \"page setup\" - like i wrote in top of this, i then have to count on the user, cause the page setup are not following the database, its different on different machines, right?
The Senedkeys \"%r\" selects the Selected for you. Obviously the user can change this, but then they can change anything in the print dialog. If all printers are available for all PC\'s then you should be able to use the Page setup method. Why dont you just make a report wich gets opened when you press on a button on your form? Th ereport can be fileterd to show just the current record on th eform and then open the printer dialaog. He cvan only print the current record on the report.
Terry > Kan jeg lave en slags makrooptagelse der vælger udskriftsdialogen, makere i selected og ligger siden ned? (Som så altså skal kunne aktiveres med en knap!
I NEVER use macroes. Everything you can do in a macro you can do in code (VBA). Lets just say that you can us ethe page setting sto set the page layout (landscape) and then the printer dialog to select \"SELECTED\" and then they can select the printer they want, isnt that good enough?
Is this because you have a dansk Access? Look at the Selected Record(s) is the \"r\" not underlined? The %r sends an Alt+r to the keyboard. If it is another character that is underlined then you need to change the \"r\" to that character.
In form design view select Page setup (or whatever it is if your using DK Access) and then page layout from the dialog. This is used only for this form and doenst mean that all form/reports get printed in landscape
Look closely at the text \"Selected Record(s)\" One of the characters is underlined, in my version it is R. The R is the shortcut key used together with Alt (Alt+R) to select this radio button (try it)
Jeg har lige indstillet \"page setup\" - og det ser ud til at virke, jeg havde prøvet tidligere men naturligvis ikke i \"design mode\" - og formdenligt af samme grund ikke noget brugbart resultat.
Når jeg bruger den kode jeg skrev, kan jeg jo se om der er vinget af i selected, når jeg kommer til udskriftsdialogen!
nothing as far as I can see, I dint know what to suggest. I have only English Access so it isnt going to help if you sent the database to me. I will play around here and get back
Ofcause i believe that we could have solved the problem, but sometimes the enjoyment of helping with questions are getting lower when you can see that a lot of people have answered the question alleready - right!
DoCmd.RunCommand acCmdPrint does the job, but the dialog appears BEFORE you can preview (actually see it on your screen) the report. How can I first preview the report and then get the print dialog up automatically?
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.