How to print all records in the active form?

  • Thread starter Thread starter mws
  • Start date Start date
M

mws

The case is:

I only want to print the data typed in the active form (more than one
record) and not the hole table.

I know that you can use the criteria function in a query to filter, but not
if it's possible to use it on the record number/record counter.
 
How do you determine 'the data in the active form'?

If you have applied a filter to the form, you may be able to use it as the
WhereCondition for OpenReport. This kind of thing:

Dim strWhere As String
If Me.FilterOn Then
strWhere = Me.Filter
End If
DoCmd.OpenReport "Report1", acViewPreview, , strWhere
 
The form is opened by a macro that opens the form in add mode. Then the user
start filling out the different fields and click next record and the starts
ower.

I cant see what to filter on that could make this work. If this cant help i
can sent you a link to the database.
 
You will need some way to determine which records are added, and it will
involve writing some code.

Loop through the RecordsetClone of the form, concatenating the primary key
value into a string. The target string will end up being something like
this:
"ID IN (55, 56, 58)"
You can then use it as the WhereCondition for OpenReport.

If ID is an AutoNumber (sequential), you could read the first autonumber
value and use:
"ID > 55"
However, that would not be reliable if other users are adding records too.
 
Back
Top