Hey Guys.. Once again back asking for some help.. Ive got my code to work. its more of a matter of fine tuning it.
I have this code:
Code:
Private Sub Command61_Click()
Dim DBSS As Database
Dim rs As DAO.Recordset
Dim varFrom As Variant
Dim StrFrom As String
Dim prod As String
Dim StrCriteria As String
Dim i As Integer
Dim j As Integer
Set DBSS = CurrentDb
Set rs = CurrentDb.OpenRecordset("SELECT ProductName, OldLocation, NewLocation, Used FROM tblTransfers")
For i = 1 To 20
If Me.Controls("item" & i) & "" = "" Or Me.Controls("n" & i) = 0 Then
Exit For
Else
With rs
For j = 1 To Me.Controls("n" & i).Value
StrCriteria = "[ProductName] = " & Me.Controls("item" & i) & " And [NewLocation] = " & Me.txtFrom.Column(0) & " And [Used] = " & 0
Debug.Print StrCriteria
.FindFirst StrCriteria
.Edit
!Used = -1
.Update
Next j
End With
End If
Next i
How ever.. I want it to look at a query and see if there are already that man marked used. If there are I want it to exit the for and move on to the next one. If there isnt I want it to do what is says to do. Edit Used to Yes.
the query used to get the number of that item marked used is called Used Stock and its lay out is as such:
Code:
SELECT DISTINCT Count(tblTransfers.TrackingID) AS CountOfTrackingID, tblTransfers.ProductName, tblProducts.PType, tblLocations.PLocation, tblTransfers.Used, tblProducts.ID
FROM (tblProducts INNER JOIN tblRequiredStock ON tblProducts.ID = tblRequiredStock.Product_FK) INNER JOIN (tblLocations INNER JOIN tblTransfers ON tblLocations.LocationID = tblTransfers.NewLocation) ON tblProducts.ID = tblTransfers.ProductName
GROUP BY tblTransfers.ProductName, tblProducts.PType, tblLocations.PLocation, tblTransfers.Used, tblProducts.ID, [type]=[type_fk]
HAVING (((tblTransfers.Used)=True) AND (([type]=[type_fk])=-1))
ORDER BY tblLocations.PLocation;
Thanks Again

Zook