From: arathra on
We have just upgraded to 2007 and are having a few minor problems. I've seen
similar threads online but can't find the solution exactly for us.

If I open a report then it shows the report with ALL the records.

If I open it with a button with this code, it shows ALL the records:

Dim stDocName As String
stDocName = "rCertificate"
DoCmd.OpenReport stDocName, acPreview

However, the moment I add stLinkcriteria it fails. This used to work under
the old Access but simply won't work now, i.e. NO records show up:

Dim stDocName As String
stDocName = "rCertificate"
stLinkCriteria = "[fIDNumber]='" & Me![fIDNumber] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

fIDNumber is an alphanumeric string (hence the single quotes around it).

I have no idea what is wrong with it and can only assume that it's due in
part to a change in Access.

From: Jörn Bosse on
Well,

the code seems fine if the criteria really is a string.
Did you already tried to create a new form with the same recordsource?

Regards
Jörn

Am 07.06.2010 17:28, schrieb arathra:
> We have just upgraded to 2007 and are having a few minor problems. I've seen
> similar threads online but can't find the solution exactly for us.
>
> If I open a report then it shows the report with ALL the records.
>
> If I open it with a button with this code, it shows ALL the records:
>
> Dim stDocName As String
> stDocName = "rCertificate"
> DoCmd.OpenReport stDocName, acPreview
>
> However, the moment I add stLinkcriteria it fails. This used to work under
> the old Access but simply won't work now, i.e. NO records show up:
>
> Dim stDocName As String
> stDocName = "rCertificate"
> stLinkCriteria = "[fIDNumber]='"& Me![fIDNumber]& "'"
> DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
>
> fIDNumber is an alphanumeric string (hence the single quotes around it).
>
> I have no idea what is wrong with it and can only assume that it's due in
> part to a change in Access.
>