Forms and where-conditions

  • Thread starter Thread starter RSGinCA
  • Start date Start date
R

RSGinCA

I have 4 forms.

In the 1st form, the user selects a product from a list and presses a button to
go to FormA. In the code for the button, I execute a DoCmd.OpenForm in order
to open FormA AND in that command I specify a 'where' condition that specifies
that product.

Then, in FormA the user presses a button to go to FormB, and from FormB he
presses a button to go to FormC. In these cases, the code again executes the
DoCmd.OpenForm command, but WITHOUT any 'where' condition. However, in these
cases the forms act as if a 'where' condition has been specified, by displaying
information for the product that was originally specified.

What's going on? Is this behavior that I can count on in my forms programming?
Or is it a fluke, or what? Are there situations where this won't work? If I
leave the code the way it is, is there a chance that I'll get a surprise
someday?

Rick
 
I have 4 forms.

In the 1st form, the user selects a product from a list and presses a button to
go to FormA. In the code for the button, I execute a DoCmd.OpenForm in order
to open FormA AND in that command I specify a 'where' condition that specifies
that product.

Then, in FormA the user presses a button to go to FormB, and from FormB he
presses a button to go to FormC. In these cases, the code again executes the
DoCmd.OpenForm command, but WITHOUT any 'where' condition. However, in these
cases the forms act as if a 'where' condition has been specified, by displaying
information for the product that was originally specified.

What's going on? Is this behavior that I can count on in my forms programming?
Or is it a fluke, or what? Are there situations where this won't work? If I
leave the code the way it is, is there a chance that I'll get a surprise
someday?

I really don't know! What are the Recordsource properties of FOrmC and
FormD? Could you post the code that opens them?
 
Subject: Re: Forms and where-conditions
From: John Vinson jvinson@STOP_SPAM.WysardOfInfo.com
Date: 2/23/2004 8:46 PM Pacific Standard Time
Message-id: <[email protected]>



I really don't know! What are the Recordsource properties of FOrmC and
FormD? Could you post the code that opens them?

Nevermind.... I'm just learning (that's my story and I'm sticking to it!).

Indeed, I AM passing the ProductID to each form. In one form, contrary to what
I said, I am indeed using the where-option of the DoCmd.OpenForm command. In
the other cases I'm doing real whacky stuff. In one instance, I have it coded
into a SELECT statement in the RecordSource property of the form by refering
back to the previous form (something like, "SELECT ... WHERE
ProductID=Forms!FormB.ProductID"). That doesn't seem like good programming
practice, but at the time I couldn't figure out any other way to do it.

Thank you for looking at my problem.

Rick
 
Back
Top