Obvious ? - print current record

Lanason

Registered User.
Local time
Today, 22:45
Joined
Sep 12, 2003
Messages
258
This may be an obvious one - but only if you know the answer.

I have displayed a single record form from a button on a listing (multi record form) - the single record form is based upon a table not on a query.
I have designed a form also based upon the same query but I just want to print the current record rather than the whole lot. I've put a button on the screen but it prints the whole table. Can I limit the report to just the record dispalyed on the form ??

My code is :-

Dim stDocName As String

stDocName = "rpt Advert"
DoCmd.OpenReport stDocName, acNormal

Thanks in advance
 
Create a query with the same field names as your report. In the criteria of your "ID" field put...

[forms]![yourformName]![ID]

Now change the reports Record Source to the new query.

HTH
IMO
 
Thanks

I thought about doing that but expected a command like

current record or Me.currentrecord etc

Oh well i've done it with the extra query
 
Sorry, misunderstood. Try this...
Code:
    DoCmd.OpenReport stDocName, acNormal, , "ID = Forms!YourformName!ID"

IMO
 
I think you mean
Code:
 DoCmd.OpenReport stDocName, acNormal, , "ID = "& Forms!YourformName!ID
Regards
 
sorted

Actullay NEITHER worked

but this did

DoCmd.OpenReport stDocName, acNormal, , "ID = " & Forms![Advert Applications]![ID]

Thanks anyway
 
And that is different HOW ???
Code:
DoCmd.OpenReport stDocName, acNormal, , "ID = " & Forms![Advert Applications]![ID] 
DoCmd.OpenReport stDocName, acNormal, , "ID = "& Forms!YourformName!ID
Only thing is the [ ] you used but that is only necessary because your using spaces in you report name.

DONT use spaces in any names any where in any DB.
(same goes for special characters &^%$#@!)(* etc )

Regards
 
Ahh - I didnt know that the [ ] were needed because of the spaces in my names, but it just worked
- never really considered that.

Thanks
 
Well al I can say is...

Learn it here Learn it NOW

DONT use spaces in any names any where in any DB.
(same goes for special characters &^%$#@!)(* etc )

Regards
 

Users who are viewing this thread

Back
Top Bottom