Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OpenForm command

Status
Not open for further replies.

obheron

Technical User
May 25, 2005
40
US
I have a form with an action button on it that when clicked opens another form. I wish to apply a filter to the opened form. what would the code be in the DoCmd.OpenForm to select those records where the value of FI in the table Components is equal to A.

I believe I have to apply the filter to the table that the text box in the form is bound to correct?

thanks.
 
I'd look at the 4th argument of the DoCmd.OpenForm method

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I know which argument it is, I am trying figure out what the code would be in this argument. Thanks.

 
It's a WHERE clause without the where keyword.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
well this is my code:

[[Components].[FI]="A"]

Components is the table
FI is the column inthe table
A is the value I want

This is the error:

can't find the field '|' referred to in your expression.


It was working when I had a macro, but i wanted to eliminate the macros and go to code.
 
Why not simply this ?
[tt]"Components.FI='A'"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Components.FI='A'"

I put this into the WHERE statement of the DoCmd line and I get this error.

Syntax error (missing operator) in query expression 'Components.FI='A'

so it's getting closer!
 
Why not make the form you are opening be based on a Parameter Query? Make the Query based on your table and in the Criteria field for FI put A.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top