titorober23
asked on
Print form - Current record
Hi Guys
Is there a way to print out the active form, current record, without using reports
I add a button in the design view which creates a macro, but it prints out the form but all the records, i need to print the form with the current record
Please advice
Is there a way to print out the active form, current record, without using reports
I add a button in the design view which creates a macro, but it prints out the form but all the records, i need to print the form with the current record
Please advice
ASKER
is there a way to put that in code behind a button
ASKER
in this particular case it is already filtered because i am trying to print a subform, which contains all the records associated with the main form, but when i hit print it prints all the records in the subform for all the records in the main form, i need to print current form view with current record information
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK ... forget this line:
DoCmd.RunCommand acCmdRemoveFilterSort ' that will cause an error.
mx
DoCmd.RunCommand acCmdRemoveFilterSort ' that will cause an error.
mx
ASKER
No they did not work
thanks
thanks
If you are already on just one record ... this should work:
Private Sub btnPrint_Click()
'Me.Filter = "[ID] = " & Me![ID]
'Me.FilterOn = True
DoCmd.RunCommand acCmdPrintPreview
End Sub
it does for me.
mx
Private Sub btnPrint_Click()
'Me.Filter = "[ID] = " & Me![ID]
'Me.FilterOn = True
DoCmd.RunCommand acCmdPrintPreview
End Sub
it does for me.
mx
what exactly is happening ?
mx
mx
ASKER
when running it is taking me to code that i ahve in the main form On_resize event
not following ?
mx
mx
titorober23,
1. The forms are not really meant to be printed, because of their graphical nature.
2. <print out the active form, current record, without using reports>
What is the reason why a report is unacceptable?
It is a faily common practice to print out a report synchronized to the selected (current) Form record.
3. How are you wanting to print the current record?
In other words, you need to be specific.
Please post a screenshot of your form.
Then post an example of the *exact* "printout" you are expecting.
Thanks.
JeffCoachman
1. The forms are not really meant to be printed, because of their graphical nature.
2. <print out the active form, current record, without using reports>
What is the reason why a report is unacceptable?
It is a faily common practice to print out a report synchronized to the selected (current) Form record.
3. How are you wanting to print the current record?
In other words, you need to be specific.
Please post a screenshot of your form.
Then post an example of the *exact* "printout" you are expecting.
Thanks.
JeffCoachman
ASKER
weel i was thinking it was easier and faster just to print current record view, instead of creating a report and try to replicate the form design
Then I see no reason why the snippet MX posted wouldn't work for you:
DoCmd.PrintOut acSelection
Can you clearly define what you mean by "they did not work"?
error message?
Crash?
Wrong Printout?
...ect
That code works fine for me...
;-)
JeffCoachman
DoCmd.PrintOut acSelection
Can you clearly define what you mean by "they did not work"?
error message?
Crash?
Wrong Printout?
...ect
That code works fine for me...
;-)
JeffCoachman
ASKER
Well they were sending to the printer all the records, it actually did the same thing that my original macro
I am trying to print out the currrent subform
I am trying to print out the currrent subform
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i guess what happens is the form that i am trying to print is a subform of another subform, where the main form is a switchboard that contains and loads different forms, when it tries to print, it activate the On_Resize event of the main switchboard form
"the form that i am trying to print is a subform of another subform,"
Ahh so ... well, ok ... that ... is going to be more complicated for sure. Whereas I do have cases where a form can be printed for convenience ... forms with subforms are another matter. As Jeff suggested ... maybe you should consider creating a report in this case. Believe me ... wherein you *can* print forms (and I do it) ... there are many anomalies for sure.
mx
Ahh so ... well, ok ... that ... is going to be more complicated for sure. Whereas I do have cases where a form can be printed for convenience ... forms with subforms are another matter. As Jeff suggested ... maybe you should consider creating a report in this case. Believe me ... wherein you *can* print forms (and I do it) ... there are many anomalies for sure.
mx
ASKER
yes i already design a report for it
thanks a lot
thanks a lot
mbizup.
FWIW,
MX did give this his all by trying to give the asker exactly what they were after, (Printing from the form) by posting no less than 3 distict alternatives.
(Even I would not have gone that far)
;-)
I have no issue with MX being awarded all the points.
Suggesting a report is something MX would have eventually suggested on his own anyway.
;-)
I will be fine with whatever you decide.
;-)
Jeff
FWIW,
MX did give this his all by trying to give the asker exactly what they were after, (Printing from the form) by posting no less than 3 distict alternatives.
(Even I would not have gone that far)
;-)
I have no issue with MX being awarded all the points.
Suggesting a report is something MX would have eventually suggested on his own anyway.
;-)
I will be fine with whatever you decide.
;-)
Jeff
split is np.
mx
mx
mx