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

Pass parameter from any form to query

Status
Not open for further replies.

techsponge

Technical User
Feb 8, 2006
37
US
I have a query that calculates the pull percentage on a game.

The query works perfectly when I hard code the WashStampNum for the criteria. I would like to display this percentage on a few different forms.

I know I could enter [Forms]![frmSales]![WashStampNum] in the criteria to pull the number from the frmSales, but I would like to pass the WashStampNum from a few different forms where this WashStampNum number is displayed.

Esentially I would like to put the following in the WashStampNum criteria:
[Forms]![frmSales]![WashStampNum]
[Forms]![frmClosedGames]![WashStampNum]
[Forms]![frmActiveGames]![WashStampNum]
[Forms]![frmEmployeeSales]![WashStampNum]
Current query SQL:

Code:
SELECT TblMasterGameList.WashStampNum, TblMasterGameList.GameName, QryGamePayout.[Total Payout], QryGameSales.TotalSlaes, TblMasterGameList.UnitCost AS [Game Cost], TblMasterGameList.TktPrice, TblMasterGameList.TktCount, [total payout]+[Game Cost] AS [Cost To Date], QryGameSales.[Qty Sold], 1-[Cost To Date]/[TotalSlaes] AS [Pull Percent]
FROM (TblMasterGameList LEFT JOIN QryGamePayout ON TblMasterGameList.WashStampNum = QryGamePayout.WashStampNum) LEFT JOIN QryGameSales ON TblMasterGameList.WashStampNum = QryGameSales.WashStampNum
WHERE (((TblMasterGameList.WashStampNum)="34166411"));



Hope this is descriptive enough?
 
Provided that the 4 forms are open and populated:
WHERE TblMasterGameList.WashStampNum In ([Forms]![frmSales]![WashStampNum], [Forms]![frmClosedGames]![WashStampNum], [Forms]![frmActiveGames]![WashStampNum], [Forms]![frmEmployeeSales]![WashStampNum])


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top