asked on
I need to query based on a selection in a form.
For now, I'm just working on the query that will select the record that I need. I'm trying to run a query based on a selection in a form/table.
At any give time I will have a record in my QREVALE form/table. The field is called TagNumber.
Below is a query that I have that does NOT call a special record. I want this query to only call the record that has the matching TagNumber from the form.
any suggestions?
SELECT
SkpiUpdate.Date,
QREVALUE.TagNumber,
QREVALUE.QPRQPINumber,
SkpiUpdate.NAMC,
FROM QREVALUE INNER JOIN SkpiUpdate ON QREVALUE.ScrapRecordTag = SkpiUpdate.ScrapRecordTag;
WHERE SkpiUpdate.ScrapRecordTag = @SelectedTagVariable
Sorry but that doesn't answer my questions.
To get the quickest answers to your questions, we need to get it if front of the best Experts. To do that, we need to know what products/programming languages you are using so we can add or change the Topic Areas the question is posted in.
ASKER
Sorry for my delay in responding. I had another issue become more urgent.
I'm getting an "Extra in query expression" error with my syntax. I have two WHERE conditions.
SELECT SkpiUpdate.Date, SkpiUpdate.NAMC,
SkpiUpdate.[Supplier Code], SkpiUpdate.[Part Number],
SkpiUpdate.[Part Name], SkpiUpdate.Quantity,
SkpiUpdate.[Defect Description],
QREVALUE.ProblemDescription,
SkpiUpdate.[Model Code],
FROM QREVALUE INNER JOIN SkpiUpdate ON QREVALUE.ScrapRecordTag = SkpiUpdate.ScrapRecordTag
WHERE (((SkpiUpdate.[Fault Type])="PPM")) AND SkpiUpdate.ScrapRecordTag = @SelectedTagVariable);
Count your parenthesis in the where clause. You have an extra one.
Since it is an AND and only two options, you don't need any parenthesis.
ASKER
Currently, I am entering the record manually.
I want to call this query while having a THE record called into a form. The query based on that selection in the WHERE Statement.
Do i need to have a reference to the form?
SELECT SkpiUpdate.Date, SkpiUpdate.NAMC,
SkpiUpdate.[Supplier Code],
SkpiUpdate.[Part Number],
SkpiUpdate.[Part Name],
SkpiUpdate.Quantity,
SkpiUpdate.[Defect Description],
QREVALUE.ProblemDescription,
SkpiUpdate.[Model Code],
SkpiUpdate.[Fault Type],
SkpiUpdate.InitialQuantity,
QREVALUE.HowFound,
QREVALUE.QREConfirmation,
QREVALUE.InterimAction,
QREVALUE.SortedQuantity,
QREVALUE.SortRejects,
QREVALUE.[SortCompletion Date],
QREVALUE.ReportDueDate,
QREVALUE.DateCode,
QREVALUE.ToyotaRank,
QREVALUE.PartsShippedDate,
QREVALUE.ShipmentTracking,
QREVALUE.ShippingCarrier,
QREVALUE.DueDate
FROM QREVALUE INNER JOIN SkpiUpdate ON QREVALUE.ScrapRecordTag = SkpiUpdate.ScrapRecordTag
WHERE (((SkpiUpdate.[Fault Type])="PPM")) And SkpiUpdate.ScrapRecordTag=[@SelectedTagVariable];
I don't know what you mean by "form". I previously asked for what products/programming languages you are using but never received a response.
ASKER
I am using Access
Form Name: QREVALUE
Control Source: QREVALUE TABLE.TagNumber
I want the TAGNUMBER that is in the form/filter to be passed into the below query as the criteria in the Where statement.
SELECT SkpiUpdate.Date,
SkpiUpdate.NAMC,
SkpiUpdate.[Supplier Code],
SkpiUpdate.[Part Number],
QREVALUE.HowFound,
QREVALUE.QREConfirmation,
QREVALUE.InterimAction,
FROM QREVALUE INNER JOIN SkpiUpdate ON QREVALUE.ScrapRecordTag = SkpiUpdate.ScrapRecordTag
WHERE (((QREVALUE.TagNumber)=[@SelectedTagVariable]) AND ((SkpiUpdate.[Fault Type])="PPM"));
ASKER
ASKER
Take a look here:
Example:
strSQL = "Select * From [Table1] Where [Field1] = " & Forms![Form1]![Control1]
ASKER
Private Sub Share_Click()
DoCmd.OpenQuery "qSaveQREValueReport"
End Sub
Should go in the saved query but I haven't done any Access programming for many years.
What database product? What form language/product?