Report from Record

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Report from Record

Post by Egg 'n' Bacon »

A bit stuck with this one, and I'm not at all clear where I've made mistakes.

I'm trying to use a button (against individual record) to ope a report, with only the records for the 'main' ID. But I keep getting a data mismatch error, yet the data is from the same source :hairout:

I've attached a stripped down version of the db & the button to the right of the records (on the form) is the one that's giving me grief.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78575
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Report from Record

Post by HansV »

In the first place, PersID is a number field, so you don't need quotes in the form of Chr(34) around the value - that is only needed for text fields:

DoCmd.OpenReport ReportName:="rptPersonSkillsGAP-FromForm", View:=acViewPreview, WhereCondition:="PersID=" & Me.PersID

In the second place, the record source of the subreport srptPersGap is based on qryPersGAP1 and qryPersGAP2. Both refer directly or indirectly to [forms]![frmPerson]![PersID] but there is no form frmPerson. Since you already use PersID to link the subreports to the main report, you should remove the condition

Like [forms]![frmPerson]![PersID]

from qryPersGap1 and qryPersGap3 (it's also in qryPersWantGAP but that isn't used elsewhere).

With these changes, it should work.
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Report from Record

Post by Egg 'n' Bacon »

Cheers :cheers:

That's done the trick