By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Code a button

P: n/a
Can I add/code a button on my form that will print only the selected record?

Thanks
Grant Dayton


Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Grant wrote:
Can I add/code a button on my form that will print only the selected record?


Yes.
;-)
Nov 13 '05 #2

P: n/a
Grant wrote:
Can I add/code a button on my form that will print only the selected record?


(air code)
Sub cmdPrint2ndRecord_Click()
Dim strBookMark as string
If Me.Dirty Then
Msgbox "Sorry, you have to save or abandon the current record first"
Else
strBookmark = Me.bookmark ' save current pos
With Me.RecordsetClone
.MoveFirst ' go to first rec
.Movenext ' go to second rec
Me.Bookmark = .Bookmark ' sync form
' insert print code here [1]
End With
Me.Bookmark = strBookmark ' return to where we was
End if
End Sub

[1] Sorry, I get stuck with the simple things, I assume you know how to
do that bit or else use the command button wizard to print the form and
copy the line of code out of that.
Nov 13 '05 #3

P: n/a
yes, you can use:
Me.Refresh

docmd.OpenReport "yourREport",acViewPreview,,"id = " & me.ID
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #4

P: n/a
Trevor Best wrote:
Grant wrote:
Can I add/code a button on my form that will print only the selected
record?


Sorry, misread, thought it said "second" record. D'oh!
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.