Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Report Error

Status
Not open for further replies.

oldwen

Programmer
Dec 2, 2003
23
US
I am recieving an error that I can not set the value of a field in my report to the value of a recordset. Any suggetions?

Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("Orlando")

rs.MoveFirst

Me.Fname = rs.Fields("fname") 'This is where it errors

rs.Close

Set db = Nothing



End Sub
 
Try performing this in the format event of the section where the control resides.

(BTW - this control should be unbound, i e no calculated or other control source)

If this means the openrecordset is performed multiple times, slowing the report, then perhaps perform this before you open the report (assuming this is done thru a form) and pass the name as openargs to the report.

[tt]docmd.openreport "rpt", acviewpreview,,,,strName[/tt]

Then in the appropriate section:

[tt]If not IsNull(me.openargs) then
Me!Fname = me.openargs
end if[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top