AboutScottgem Expertise I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.
Experience I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.
Organizations Author of Microsoft Office Access 2007 VBA Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing
Hope you can help...
I'm building an Event at Access to visualize a report (called Carttões) linked to the data of two fields: [codigorodada] and [caixas].
I only know how to set the linking criteria for one field, how could I put the StLinkCriteria for both fields?
-------------------------------------
Private Sub Comando184_Click()
On Error GoTo Err_Comando184_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Cartões"
stLinkCriteria = "[codigorodada]=" & Me![codigorodada]
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_Comando184_Click:
Exit Sub
Err_Comando184_Click:
MsgBox Err.description
Resume Exit_Comando184_Click
End Sub
-------------------------------------
Thanks in advance!
Tiago.
Answer Frankly I wouldn't do it that way. Since you are running this report from a form, that means the form is open. What I would do is base my report on a query. In the criteria section of the query, use:
=Forms!formname!controlname
where formname is the name of your form and controlname the name of your query. The query will then be filtered based on the values of the current record. This is they I do almost all my filtered reports.
If you want to use the Filter parameter of the OpenReport method, the solution though is simple: