Open form with link criteria

MikeLeBen

Still struggling
Local time
Tomorrow, 00:53
Joined
Feb 10, 2011
Messages
187
I want a form to be openable from various other forms, and have used the following code to pass the ID from the original form to the opened one:
Code:
    DoCmd.OpenForm "frmAggOrdini", acNormal
    With Forms!frmAggOrdini
        .DataEntry = True
        .cboCliente = Me.frmDettaglioClienti.Form.IDCliente
    End With

I then want some controls on the opened form to be visible whether a certain condition is met, and that's a dlookup on some table with the ID I pass to the form.

It seems though that I have to check this condition on the several original forms while I'd like to code it just once on the form-to-be-opened.

Is there a way to do it?
 
I then want some controls on the opened form to be visible whether a certain condition is met, and that's a dlookup on some table with the ID I pass to the form.

You don't say how you are passing the ID to the form being opened, but if you use the "OpenArgs" argument of the DoCmd.OpenForm, then you could examine the "OpenArg" property of the form being opened (in its' OnOpen event) using If..Then..Else and set the visible property of the controls.
 
beautiful.
 

Users who are viewing this thread

Back
Top Bottom