Pregunta

i have a report which is based on a query ! when i run he report it asks for a perimeter THEID. what i want to do is that when i open the report the via form the THEID = CID (a field in the form via a button)

so far i have written this code which still ask me for the THEID PERIMETER via dilog box when i click the button.

the query

SELECT Carrier.CID, Carrier.CName, Carrier.CRepName, Carrier.CRepContact, Carrier.CBalance, Carrier.CReorderBalance
FROM Carrier
WHERE (([THEID]=[CID]));

the vba code

Private Sub Command56_Click()
On Error GoTo Command56_Click_Err
    Dim THEID As Integer
    DoCmd.OpenReport "Current Carrier", acViewPreview, "", "[THEID]='" & CID & "'", acNormal


Command56_Click_Exit:
    Exit Sub

Command56_Click_Err:
    MsgBox Error$
    Resume Command56_Click_Exit

End Sub
¿Fue útil?

Solución

turns out i was using the wrong query i relapsed it with the following

SELECT Carrier.CID, Carrier.CName, Carrier.CRepName, Carrier.CRepContact, Carrier.CBalance, Carrier.CReorderBalance
FROM Carrier
WHERE (([CID]=[Forms]![Carrier]![CID]));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top