Open Form and Filter

dsellers1

Registered User.
Local time
Today, 12:19
Joined
May 19, 2009
Messages
39
My form, frmDAS, is used to enter a Control Number along with many other fields. Once entered, it is routed through a query that populates a separate form, frmDAS_Edit, for the user to go in and modify the data if need be. I have a search box on the frmDAS_Edit that will filter the information by Control Number. However, I am wanting a search box on a new form that will open and filter the frmDAS_Edit as well. Can you guys tell me what I'm missing?

The following is the OnClick command for my button after entering the Control Number in the Searchbox

Private Sub Searchbutton_Click()
DoCmd.OpenForm "DAS_Edit", acNormal, ,"[Searchbox] = " & [Forms]![DAS_Edit]![Control Number]
End Sub
 
What's the problem with what you have? Off the top of my head, it appears you've reversed the items in the wherecondition. It should probably be:

DoCmd.OpenForm "DAS_Edit", acNormal, ,"[Control Number] = " & Me.[Control Number]
 
Thanks pbaldy, you were right! Though I am now completely embarrassed, I had them backwards. For all interested, the code would be:

DoCmd.OpenForm "DAS_Edit", acNormal, ,"[DAS_Edit] = " & Me.[Searchbox]

Not:

DoCmd.OpenForm "DAS_Edit", acNormal, ,"[Searchbox] = " & Me.[DAS_Edit]
 

Users who are viewing this thread

Back
Top Bottom