recordset's current position

8

85ascMcLaren

Anyway I can pass ONLY the current record in a recordset to a report instead
of the whole recordset...

Something like ....
while not rs.eof do
'open report'
.movenext
loop

And in the report open, I can set the recordsource to that record only.
If I set it to the 'rs' (me.recordsource = rs), it will grab the entire
recordset, which is NOT what I want.... I do not if the absolute position
will work or SOME property like that , which I can append to the
(me.recordset = rs.(SOME PROPERTY WHICH ONLY GIVES THE CURRENT RECORD IN THE
RECORDSET)...

The long way is to assign individual text boxes to the rs.field during the
detail print section. Looking for a much shorter way as I described
above......

Thanks,
Jason
 
B

BruceM

If you mean you are looking at a record on a form, and want to open a report
to that record, a command button click event could have something like:

If Me.Dirty Then Me.Dirty = False

Dim strRpt As String
Dim strLink As String

strLink = "[KeyField]=" & Me.[KeyField]
strRpt = "ReportName"
DoCmd.OpenReport strRpt, acPreview, , strLink

The command button wizard will produce a similar result. I'm not sure if
the Me.Dirty line of code is necessary, but it doesn't hurt. KeyField would
be the primary key field (or other unique field). The code assumes KeyField
is a Number field. If it is a text field it would be:

strLink = "[KeyField]=""" & Me.[KeyField] & """"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top