473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DoCmd.PrintOut acSelection = false advertising?

EJO
TIA,

There is already a form (Access 2k) with the selected record and a
button with this code behind it:

DoCmd.PrintOut acSelection

Except that Access does not print the acSelection, it prints the entire
query result behind the form. How does one do what VB says it will
do:
Print the acSelection on the form?
(without doing something so antithetical to engineering as duplicating
work by creating a report, indicated by so many other articles)

Is there a patch for this bug?

Apr 20 '06 #1
6 10002
did you try using a report and passing the current record's unique ID
in the Open event? Forms aren't really designed for printing out, but
for data entry.

Apr 21 '06 #2
"EJO" <My****@gmail.com> wrote in news:1145557535.825523.137390
@i40g2000cwc.googlegroups.com:
TIA,

There is already a form (Access 2k) with the selected record and a
button with this code behind it:

DoCmd.PrintOut acSelection

Except that Access does not print the acSelection, it prints the entire
query result behind the form. How does one do what VB says it will
do:
Print the acSelection on the form?
(without doing something so antithetical to engineering as duplicating
work by creating a report, indicated by so many other articles)

Is there a patch for this bug?


I think this is not a bug. There's no reason to think that the DoCmd Object
will be aware of what one has selected with the mouse or keys.

This prints one record for me.

Private Sub cmdPrintRecord_Click()
With DoCmd
.RunCommand acCmdSelectRecord
.PrintOut acSelection
End With
End Sub

--
Lyle Fairfield
Apr 21 '06 #3
EJO
thanks, for the reply; please don't be offended, but the suggestion of
using a report was exactly the suggestion I was trying to avoid.

As an engineer, I view having to build a report in order to print the
record displayed in the form as being duplicate work and worse, having
to maintain two documents is entirely inefficient. Both are
antithetical to eveything I learned about being an engineer!
Unfortunately, being a programmer by circumstance rather than by trade,
these minor differences are frustrating and seem more a 'patch' than a
fix. Kudos to you pros who can keep up with all of it and help us
not-so-understanding folks!

Apr 21 '06 #4
EJO
Hi, Lyle, and thanks! I tried it, but am still getting the entire
query record set. The reason I am calling this a bug is because the
code did not ask for acPrintAll, yet that is exactly what acSelection
is doing. I don't understand "There's no reason to think that the
DoCmd Object will be aware of what one has selected with the mouse or
keys." According to vb help, the PrintOut action doesn't care if I
have a form or report; but perhaps my understanding of acSelection is
not in the proper scope? When i think of acSelection, the 'record
selectors' on a form come to mind indicating the selected record (not
saying the two are related, but that is what comes to mind). Further
consider that the PrintOut action offers ranges of selection
(acPrintAll or acPages), and it re-inforces the perception that
acSelection refers to what ever record is the current record, whether
in a form or report, not the entire range of records behind the form or
report--which is what vb help says those other two actions are to
perform.

Even tried setting the 'cycle' property to 'current record'; using the
record selector to 'select' the record prior to print, and modified
just about any other setting that might even hint at how or what is
printed.

Apr 21 '06 #5
"EJO" <My****@gmail.com> wrote in
news:11**********************@j33g2000cwa.googlegr oups.com:
thanks, for the reply; please don't be offended, but the
suggestion of using a report was exactly the suggestion I was
trying to avoid.

As an engineer, I view having to build a report in order to
print the record displayed in the form as being duplicate work
and worse, having to maintain two documents is entirely
inefficient. Both are antithetical to eveything I learned
about being an engineer! Unfortunately, being a programmer by
circumstance rather than by trade, these minor differences are
frustrating and seem more a 'patch' than a fix. Kudos to you
pros who can keep up with all of it and help us
not-so-understanding folks!

I consider myself an engineer too, (so does my boss), but I
interpret your view of creating a report being duplication of
work in the vein of "I have a tool! I don't need another tool."

My reply to this is "you have a hammer. you also need a
screwdriver."

Forms I design have all sorts of things that I need like command
buttons, record selectors, areas of colour, controls used to
enter filter criteria that simply get in the way of presenting
data to the end user. a separate report lets me reorganize the
data layout for efficiency of understanding, whereas the form is
built for data entry, or data location, or updating.
Each is a separate task, and each has an optimized layout for
that one purpose.
As to your original question, the issue is again one of
interpretation, in this case of AcSelection. To me the Ac prefix
indicates that the selection is at the Access level, which
contains the object form, or query or report... Had the constant
been called frmSelection, then it would refer to the control or
record selected on the form.

--
Bob Quintal

PA is y I've altered my email address.
Apr 22 '06 #6
EJO
Thank you, Bob. You have put this in the proper perspective for me,
regardless of how much I may not like it ;)

Apr 24 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Klefevre | last post by:
Hi, I was wondering why the code below does not work in ASP. Why does the printout method not work? Tx, Kurt Dim m_strPrinterDeviceName Dim m_objExcelApplication, m_objExcelWorkBook,...
0
by: ivan | last post by:
I have a command button that uses the following command to print out the current record on the screen: DoCmd.PrintOut acSelection I get the following error message when I try to enter the NEXT...
0
by: ivan | last post by:
Access97 While in ADD mode- I have a command button that has the following: DoCmd.Printout acSelection This command gives me an error message (after it prints), that there is not enough...
0
by: Owen Jenkins | last post by:
I use the DoCmd.Printout method to print reports using the client's default options This has worked fine for years with Access 97 and 2000/2, Win95-XP. However two clients have recently complained...
3
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc....
2
by: Smartin | last post by:
Question about DoCmd.PrintOut in A97. I have a form on which all the controls are unbound. There is a large textbox that the user can type stuff in and a couple labels. I am trying to code a...
1
by: natural | last post by:
Good Afternoon I have an option grou[ and on the after update i would like to provide the user with a msgbox, and then action placed my docmd.setwarnings false everywhere, but i still get my...
1
by: =?Utf-8?B?S2ltIFM=?= | last post by:
I have a word document I only want to printout ( not save as file ) and I use Word printout method in backgrund but my XP operativ i so slow that a "dummy" dociment also get stored. which...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.