stLinkcriteria no longer working (since 2007 upgrade)

  • Follow


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.

0
Reply arathra 6/7/2010 3:28:21 PM

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.
>

0
Reply UTF 6/7/2010 3:37:00 PM


1 Replies
528 Views

(page loaded in 0.062 seconds)

Similiar Articles:
















7/16/2012 6:44:39 PM


Reply: