Solved MS Access print form instead of report (1 Viewer)

Akai90

Member
Local time
Today, 16:34
Joined
Feb 8, 2022
Messages
65
hai

i have problem sometime my print preview report will print form not a report. print preview show report but it will print forms not report (sometime will print report but sometime will print forms)..
can i know what the problem ? any wrong setting ?

report call via button from forms
button using marco setting

print report.png
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:34
Joined
Feb 19, 2002
Messages
42,970
Remove the macro and do it with VBA. It only takes one command:

DoCmd.OpenReport "xxx".......

Access will help you with intellisense to complete the string.
 

Akai90

Member
Local time
Today, 16:34
Joined
Feb 8, 2022
Messages
65
Remove the macro and do it with VBA. It only takes one command:

DoCmd.OpenReport "xxx".......

Access will help you with intellisense to complete the string.
TQ for the reply.
 

Akai90

Member
Local time
Today, 16:34
Joined
Feb 8, 2022
Messages
65
Remove the macro and do it with VBA. It only takes one command:

DoCmd.OpenReport "xxx".......

Access will help you with intellisense to complete the string.
already try this code but.. it will direct print the report.
i want open the print preview first to check all data is correct.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:34
Joined
May 7, 2009
Messages
19,169
you are "missing" additional parameter:

docmd.OpenReport "report_name", acViewPreview
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:34
Joined
Feb 19, 2002
Messages
42,970
already try this code but.. it will direct print the report.
You might want to examine ALL the arguments of a command before saying they don't work.
print preview show report but it will print forms not report (sometime will print report but sometime will print forms)..
This won't happen with the VBA command because it is specific about what it is opening, but if you use the same name for two objects (form and report), you get what you asked for - confusion.

Access only forces uniqueness between tables and queries and that is because in most cases tables and queries can be used interchangeably. Having duplicate names would prevent that.
 
Last edited:

Users who are viewing this thread

Top Bottom