From: nytwodees on
I use Access 2000.

I have a form that has a command button to Create an Invoice. When this
button is clicked a Dialog Pop-up form appears. The user is required to
enter 2 pieces of data in this form. On this form there is a command button
to Preview the invoice.

I have no problem of passing the 2 pieces of user data from the Dialog
Pop-up to the underlying query. What I do not know how to do is pass the
initial form's CustomerID control value to the query and/or the code for the
Preview command button.

I know this should be pretty simple to accomplish but I am bewildered at
this point, after a lot of experimenting. Help!!!



From: NG on
Hi,

there are several ways to do this, but a pretty easy way is to pass the
CustomerID as an opening argument in your dialog form, example:

docmd.OpenForm "MyDialogForm",,,,,acDialog,CustomerID

in the code in your preview button you can then use the property OpenArgs of
the form to retrieve the ID

success
NG

"nytwodees" wrote:

> I use Access 2000.
>
> I have a form that has a command button to Create an Invoice. When this
> button is clicked a Dialog Pop-up form appears. The user is required to
> enter 2 pieces of data in this form. On this form there is a command button
> to Preview the invoice.
>
> I have no problem of passing the 2 pieces of user data from the Dialog
> Pop-up to the underlying query. What I do not know how to do is pass the
> initial form's CustomerID control value to the query and/or the code for the
> Preview command button.
>
> I know this should be pretty simple to accomplish but I am bewildered at
> this point, after a lot of experimenting. Help!!!
>
>
>
From: nytwodees on
Hi NG:

Thanks for your response!

1. Do I put the following code:

"docmd.OpenForm "MyDialogForm",,,,,acDialog,CustomerID"

with the code for the Preview Command Button?


2. How does the query know what the criteria is for the CustomerID?


3. Can the criteria for the CustomerID be placed into the query's grid"

MY level of sophistication is limited in SQL and VBA.

"NG" wrote:

> Hi,
>
> there are several ways to do this, but a pretty easy way is to pass the
> CustomerID as an opening argument in your dialog form, example:
>
> docmd.OpenForm "MyDialogForm",,,,,acDialog,CustomerID
>
> in the code in your preview button you can then use the property OpenArgs of
> the form to retrieve the ID
>
> success
> NG
>
> "nytwodees" wrote:
>
> > I use Access 2000.
> >
> > I have a form that has a command button to Create an Invoice. When this
> > button is clicked a Dialog Pop-up form appears. The user is required to
> > enter 2 pieces of data in this form. On this form there is a command button
> > to Preview the invoice.
> >
> > I have no problem of passing the 2 pieces of user data from the Dialog
> > Pop-up to the underlying query. What I do not know how to do is pass the
> > initial form's CustomerID control value to the query and/or the code for the
> > Preview command button.
> >
> > I know this should be pretty simple to accomplish but I am bewildered at
> > this point, after a lot of experimenting. Help!!!
> >
> >
> >