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

Combo Box as Filter 1 or 2 or Both

Status
Not open for further replies.

uncleG

Technical User
Jun 10, 2004
63
US
I would like to be able to select values in Combo1 (year) or Combo3 (month) or both, then display the recordset on frmSuppEvalMonth for analisis.

I am using a form called called frmSuppEvalFilter to set the values of Combo1 and Combo3 then click a command button (Command7) there to display frmSuppEvalMonth (code follows)

******
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmSuppEvalMonth"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub
***********
The following Query provides the Results I need if opened after criteria is set from frmSuppEvalFilter however when a I try to display this on a second form calledfrmSuppEvalMonth it displays no records, although this forms record source is set to this query called qrySuppEvalFilter (SQL follows)


SELECT DISTINCTROW tblWOPO.WoPoID, tblWOPO.ConID, tblContacts.CoName, tblContacts.Street, [City] & "," &

" " & [State] & " " & [Zip] AS CSZ, tblContacts.Email, tblProcess.ProcessName, tblWOPO.QuanityOut,

tblRecieving.DateRecieved, Format(tblRecieving!DateRecieved,"yyyy") AS ReInYear,

Format(tblRecieving!DateRecieved,"mm") AS ReInMonth, [DateRecieved]-[DatePromised] AS dDateDiff,

IIf([DateRecieved]<=[DatePromised],"0","1") AS delScore, IIf([DateRecieved]>=[DatePromised],"1","1") AS

delCount, tblWOPO.Status, Sum(tblRecieving.QtyRecievied) AS [Sum Of QtyRecievied],

Sum(tblRecieving.QtyAccepted) AS [Sum Of QtyAccepted], Sum(tblRecieving.QtyRejected) AS [Sum Of

QtyRejected], Sum(tblRecieving.QtyRework) AS SumOfQtyRework, Sum(tblRecieving.QtyScraped) AS

SumOfQtyScraped, tblWOPO.DatePromised, Format([tblRecieving]![DateRecieved],"yyyy"),

Format([tblRecieving]![DateRecieved],"mm")
FROM (tblProcess INNER JOIN (tblContacts INNER JOIN tblWOPO ON tblContacts.ConID = tblWOPO.ConID) ON

tblProcess.ProID = tblWOPO.ProID) INNER JOIN tblRecieving ON tblWOPO.WoPoID = tblRecieving.WoPoID
GROUP BY tblWOPO.WoPoID, tblWOPO.ConID, tblContacts.CoName, tblContacts.Street, [City] & "," & " " &

[State] & " " & [Zip], tblContacts.Email, tblProcess.ProcessName, tblWOPO.QuanityOut,

tblRecieving.DateRecieved, Format(tblRecieving!DateRecieved,"yyyy"),

Format(tblRecieving!DateRecieved,"mm"), [DateRecieved]-[DatePromised],

IIf([DateRecieved]<=[DatePromised],"0","1"), IIf([DateRecieved]>=[DatePromised],"1","1"),

tblWOPO.Status, tblWOPO.DatePromised
HAVING (((Format([tblRecieving]![DateRecieved],"yyyy"))=[Forms]![frmSuppEvalFilter]![Combo1]) AND

((Format([tblRecieving]![DateRecieved],"mm"))=[Forms]![frmSuppEvalFilter]![Combo3]))
ORDER BY tblWOPO.ConID;

What am I doing wrong, I welcome input after 2 days of trying many different methods
Thanks, UncleG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top