Open Form Based on Criteria

J

JK

I have a db (Access03) that I'm using to track consumer complaints. I first
have my item master form with a subform that displays all complaints assigned
to the item that is displayed. I have a edit button next to each complaint so
that a specific complaint can be opened and edited.

I also have a button that is on the main form that i would like to use to
display all complaints assigned to the item that is displayed. However, when
I click the button, I get every complaint in the database - not just
complaints assigned to the item that is displayed.

This is the code I'm using. Would anyone be able to tell me why this is not
working? I've tried doing this a number of different ways. I even tried
creating a seperate query with code in the on open event to change the
recordsource but that didn't work either.

stLinkCriteria = "[ProductID]=" & Me![ProductID]
DoCmd.OpenForm FormName:="frmItemComplaintDataEntry", _
WhereCondition:=stLinkCriteria

Any help would be appreciated thanks!

Jason
 
M

Marshall Barton

JK said:
I have a db (Access03) that I'm using to track consumer complaints. I first
have my item master form with a subform that displays all complaints assigned
to the item that is displayed. I have a edit button next to each complaint so
that a specific complaint can be opened and edited.

I also have a button that is on the main form that i would like to use to
display all complaints assigned to the item that is displayed. However, when
I click the button, I get every complaint in the database - not just
complaints assigned to the item that is displayed.

This is the code I'm using. Would anyone be able to tell me why this is not
working? I've tried doing this a number of different ways. I even tried
creating a seperate query with code in the on open event to change the
recordsource but that didn't work either.

stLinkCriteria = "[ProductID]=" & Me![ProductID]
DoCmd.OpenForm FormName:="frmItemComplaintDataEntry", _
WhereCondition:=stLinkCriteria


stLinkCriteria = "[ProductID]=" & Me![ProductID] _
& " AND [ItemID] = " & Me.subformcontrol.Form.[ItemID]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top