Fred: this is the code as I have written it:
Private Sub ARRIVO_Click()
On Error GoTo Err_ARRIVO_Click
Dim stDocName As String
stDocName = "Arrivo"
DoCmd.OpenReport stDocName, acViewPreview, ,
"[Dossier]=""&[Dossier]&"""
Exit_ARRIVO_Click:
Exit Sub
Err_ARRIVO_Click:
MsgBox Err.Description
Resume Exit_ARRIVO_Click
End Sub
and this is the report's Record Source:
SELECT MAWB.Dossier, MAWB.MAWB, MAWB.AirLineCode, MAWB.Pieces,
MAWB.Weight,
MAWB.CWeight, MAWB.Notified, MAWB.Notes, MAWB.DateOut, MAWB.DateIn,
MAWB.IdConsignee AS MAWB_IdConsignee, Consignee.Consignee, Consignee.Tel,
Consignee.Fax, Consignee_Contatti.IdContatto,
Consignee_Contatti.IDConsignee
AS Consignee_Contatti_IDConsignee, Consignee_Contatti.Contatto,
Consignee_Contatti.Email
fredg said:
On Tue, 22 Nov 2005 21:43:38 +0100, antonov wrote:
Fred, I have tried what you told me (I've changed [RecordID] into
[Dossier]). When I run the event it asks me to enter Parameter
value....
what do I do wrong?
On Tue, 22 Nov 2005 21:13:46 +0100, antonov wrote:
Hello again everybody.
I have created my tables and my forms. I've also created my reports
but
I
cannot get a report to open exactely at the record from which I call
it...
How can I do that?
Your table should have a unique prime key field.
If so, code the command button's Click event:
DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " &
[RecordID]
The above assumes a [RecordID] field that is a Number Datatype.
If [RecordID] is Text Datatype, then use:
"[RecordID] = '" & [RecordID] & "'"
as the Where clause.
Change the field name to whatever the actual field name is that you
are using.
See Access Help files for:
Where Clause + Restrict data to a subset of records'
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Is [Dossier] the actual name of your prime key field?
Is it spelled exactly like that?
Copy and paste your exact code.