Hi, Filo.
I'll slow down. Access forms and their controls all have "events"
associated with them. When the event occurs, any procedure defined for the
event runs, giving you a great deal of control over how data is entered, what
the user sees, etc. For example, among others, textboxes have OnGotFocus,
BeforeUpdate, AfterUpdate, OnLostFocus events. Command buttons have, among
others, OnClick and OnDblClick events.
I'd assumed that you would be using a command button on your form to print
the report for the current record. The code I included would be placed in
the CommandButton's OnClick Event procedure. If you've never done this
before, open your form, and display the Toolbox (View, Toolbox). First turn
the wizard off (toggle off the Wand & Stars button on the toolbox). Click on
the command button icon, and draw one on your form. If you wish to rename it
from the Access default name given it, do so now before proceeding.
Right click on the button and select Properties, and click on the Event tab.
Click into the OnClick field, then press the ellipsis to the right of the
field, and select CodeBuilder. Access will create the shell of an OnClick
procedure for you. Cut and paste the code I posted between the Sub and End
Sub lines, change all occurences of "YourReport" to the name of your report,
and save it. This code will now be run when the user clicks on the button.
Hope that helps.
Sprinks
filo666 said:
what??? I didn't understand a word, where I gona put all wat you write?? a
macro i supose???
:
Hi, Filo.
Assign a Filter using the primary key of the current record, and turn the
filter on:
DoCmd.OpenReport "YourReport", acPreview
Reports![YourReport].Filter = "YourPrimaryKey = " & Me![YourPrimaryKeyControl]
Reports![YourReport].FilterOn = True
Hope that helps.
Sprinks
:
Hello, I want to crate a macro that prints just one record of one form linked
to a table with 54 records, when I try to print the report the 54 records are
printed¡¡¡