i’m very new to Access and VB, and im about to print a specific record.. but im getting an error with this code:
Private Sub printEksternAVR_Click()
DoCmd.OpenReport [Report_AVR Ekstern], acViewPreview, , [Report_AVR Ekstern].Rapport_nr = Forms!Form_AVR
End Sub
My reports name is AVR Ekstern, and the prime key is Rapport nr and the form im clicking the button and viewing the record in, is AVR
i think i misunderstood something alon the way, so i really hope someone can help me out here?
The WHERE condition is a string. You’ll need to wrap that parameter in quotes. Assuming
Rapport_nris an Integer:Er wait, you’re also missing the field in Forms!Form_AVR which you’re supposed to use as the key value placeholder in the query string. You’re just referencing the form itself there. Add that form field name at the end there too, whichever field holds the key value you’re looking up.
See: this MSDN page for more details.