Problem in the where section

  • Thread starter Thread starter Eric Plante
  • Start date Start date
E

Eric Plante

I'm a new Access 97 developper and I have a problem trying to open the right
form using a macro in a button. I can open the form no problem but it
doesn't seem to take into account the where section.

Example: In Form A, I have Item Y. I want to open Form B that has the item X
that must be equal to item Y. How can I do it with Access? Using the wizard,
I either get a form that opens with nothing or I use the visible value and
wonder why it shows me a form B that doesn't have the requested information.

The most obvious where in this case should be: [Forms]![FormA]![ItemY] =
[Forms]![FormB]![ItemX] but that opens an empty FormB. if I add .[visible],
I get the FormB with the first item entered in its database.

Anyone can help me?
 
Eric,

As I understand it, you have a command button on FormA, and on its On
Click event property you have a macro which uses the OpenForm action
and nominates FormB as the form to open. Is this correct? And in the
recordsource of FormB you have a field called ItemX. Is this right?
And you want FormB to open at the record where the value of ItemX is
the same as the value of ItemY in the current FormA? Ok, the syntax
for the Where Condition argument of the OpenForm macro action should
be:
[ItemX]=[Forms]![FormA]![ItemY]

If you get a parameter prompt for ItemX when you click the button, it
would probably indicate that FormB does not contain an ItemX field, so
the first thing to check is your spelling!

- Steve Schapel, Microsoft Access MVP
 
Back
Top