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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a form on an inputbox value.

Status
Not open for further replies.

Aerowolf

Programmer
Nov 6, 2002
64
Here's the code I've got:

Dim QTY As String, q As Integer, p As Integer, ITEM As String

ITEM = InputBox("Enter unit part #:")
DoCmd.OpenForm "frmBOM"
DoCmd.ApplyFilter , [Forms]![frmBOM]![PARENTPART] = ITEM
If [Forms]![frmBOM]![PARENTPART] <> ITEM Then
result = MsgBox("There is no Bill of Materials for this item.")
DoCmd.Close acForm, "frmBOM"
End
End If


The problem is that frmBOM is not being filtered...why not?

Edwin
 
You can just open the form with filtering

DoCmd.OpenForm frmName,,,"ParentPart = '" & Item & "'"
(if item is a string)


DoCmd.OpenForm "frmName",,,"ParentPart = " & Item
(if item is a number)

could make your code this way:

Code:
DoCmd.OpenForm "frmBOM",,,"ParentPart = '" & InputBox("Enter Unit part #: ") & "'"

-Pete
 
Or change the code a little:
[tt]ITEM = InputBox("Enter unit part #:")
DoCmd.OpenForm "frmBOM"
DoCmd.ApplyFilter , "[PARENTPART] = " & ITEM[/tt]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top