Printing after clicking on a checkbox

B

bert

Hello
I have the following problem
In a access file i order spare parts for my machanics.
The mechanics can, whit a checkbox, tell me wat part i must order.

When i recive the parts i can see in a form whitch of the mechanics orderd
that part
in that form i have a check box, this form is built up whit a quary,
And the checkbox is "on"/"1"

Now when i uncheck the checkbox i what a form, from the printer whit on that
form
all the informatie from that record of whitch i just uncheckt the check box.

I can whit a marco do the following:
Private Sub is_besteld_Click()
DoCmd.PrintOut acSelection, , , acHigh, 1, 1
End Sub
Now i get a printout of the form, but thats so large that it is over 4
pages.

What i really what is, and that is my question, how can i in the same way
print a report from the checkbox that i have just uncheckt?

i can really juse a helping hand here.


Thanks for any help.
Bert-Jan
 
H

Howard

Assuming you have some primary key shown on the form that you can use to
select the record to show in your report, you can use the following
syntax. Here I have assumed that my primary key is called ID and that it
is numeric.


DoCmd.OpenReport "MyReportName", acPreview, , "[id] = " & Me.ID

If the primary key (ID in my example) is a string of some sort rather
than a number, then the criteria needs to enclose it within quotes.
However, since the whole criteria is also enclosed in quotes you have to
use a combination of single and double quotes like this.

DoCmd.OpenReport "MyReportName", acPreview, , "[id] = '" & Me.ID & "'"

That's <double quote> [ID] = <single quote> <double quote> & Me.ID &
<double quote> <single quote> <double quote>

The two commas after the word acPreview are deliberate.
If you want to print it directly without previewing it first use acPrint
instead of acPreview.

Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top