From a form view the page on the report related to that member.

C

Céline Brien

Hi,
By clicking on a button in a form, I want to view the page of the report
related to that member.
The codes are below.
I get an error message : Type de données incompatible dans l'expression
du critère.
The field NoMembre is numeric. I tried Dim stLinkCriteria As Variant,
same error message.
What's wrong ?
Many thanks,
Céline
Using Access 97
------------------------------------------------------------------------
-
Private Sub ImprimeMiniSondage_Click()
On Error GoTo Err_ImprimeMiniSondage_Click


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EMiniSondage"
stLinkCriteria = "[NoMembre]=" & "'" & Me![NoMembre] & "'"

DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria


Exit_ImprimeMiniSondage_Click:
Exit Sub

Err_ImprimeMiniSondage_Click:
MsgBox Err.Description
Resume Exit_ImprimeMiniSondage_Click

End Sub
 
C

Céline Brien

Hi Ron,
It works !
Thank you so much !
Have a good day,
Céline

Ron Weiner said:
Try changing the stLinkCriteria to:

stLinkCriteria = "[NoMembre]=" & Me![NoMembre]


Ron W
www.WorksRite.com

Céline Brien said:
Hi,
By clicking on a button in a form, I want to view the page of the report
related to that member.
The codes are below.
I get an error message : Type de données incompatible dans l'expression
du critère.
The field NoMembre is numeric. I tried Dim stLinkCriteria As Variant,
same error message.
What's wrong ?
Many thanks,
Céline
Using Access 97
----------------------------------------------------------------------
--
-
Private Sub ImprimeMiniSondage_Click()
On Error GoTo Err_ImprimeMiniSondage_Click


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EMiniSondage"
stLinkCriteria = "[NoMembre]=" & "'" & Me![NoMembre] & "'"

DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria


Exit_ImprimeMiniSondage_Click:
Exit Sub

Err_ImprimeMiniSondage_Click:
MsgBox Err.Description
Resume Exit_ImprimeMiniSondage_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top