Microsoft Access Help

  eccomputers 23:03 20 May 03
Locked

I have created a simple table and form. Several records have been entered and I have created a
report so I can print out the information.

I know I can print the current form, but I want it in the format designed in reports. If I select to print from the command button on my form, ALL records are printed. Is there a way I can make it print JUST the current record rather than all of them. There must be a way, imagine having 3 thousand records printing everytime you only want one :)

Many thanks

  Michael-240508 04:32 21 May 03

Hi there
I use access for a database. When I want to print just one form then all I do is when prompted for a page range after clicking print I just put in the number of the record I want to print. Make sure you put the same number in to and from boxes.
It will then print the page in the record you require.

  IanNiblock 08:34 21 May 03

If you have a query as the recordsource for the report then this should be quite simple (if not then I would advise creating a query). If you open the query in design view then you will see a space to enter criteria for each column.

I am assuming that the table you are selecting data from has a single ID field.

In the criteria field for the column of the query that references the ID you can reference a control on your form - you would need to put something like =[MyForm)![TextBox1]

The query would then only return the record that was currently selected on the form?

Is this any help?

  recap 10:18 21 May 03

To do the following code building you will need to create a "Print" button. Once the button is created right click and select "code building". Then enter the following.

Private Sub Print_click()

On Error GoToErr_PrintCommand_Click 'If there is an error execute our error routine'

'The follwoing instruction Print Preview the form "*************"
DoCmd.OpenForm"***********",acPrintForm,,Me.Filter

Exit_PrintCommand_Click: 'Exit PrintCommand
Exit Sub

Err_PrintCommand_Click: 'Our error routine

MsgBox Err.Description 'Our error routine
Resume Exit_PrintCommand_Click 'Exit PrintCommand


End Sub

Where ***** are inserted you will need to enter the name of the form you want printed off.


The "PrintForm" prints all visible objects and bitmaps of the UserForm object. PrintForm also prints graphics added to a UserForm object. This "PrintForm" can be change to suite your needs, just go to help in code builder and type in Print and you can see the selection of option open to you.

I hope the above code formats correctly for you to see how it should be spaced and, that it works for you.

This thread is now locked and can not be replied to.

Xiaomi Mi5s review: The Xiaomi flagship that could replace your Samsung, LG, HTC or Apple phone

1995-2015: How technology has changed the world in 20 years

Mental Canvas is a brand new drawing app that's quite unlike any other

New MacBook Pro 2016 review | MacBook Pro with Touch Bar review: Apple's super-expensive new…