I have two tables in the same database. One holds recipe numbers that do not change (Recipes). The other holds the part information (ZoneData). The zonedata table will be searching the recipe table to see if it holds the right number. I have code right now that doesn't seem to be working consistantly. I am checking every "BDSBatch" field in the zonedata table. Basically just searching if it even exists in the Recipes table. Is there anyway to just get an accurate true/false statement? I have tried .absoluteposition, keep getting a "-1" or "0". Tried .Nomatch and received a false every time. Even after the dbase was altered so there wouldn't be a match. Help. You'll notice that I was trying different things to see if I could capture a match or nomatch.
Do
ConnectString = "SELECT * FROM ZoneData WHERE [ID] = " & RecCount '&" 'TRUE AND [Robot] = 1" '& RobotCount
Set m_ZoneData = m_MasterDatabase.OpenRecordset(ConnectString)
With m_ZoneData
RecipeCheck = 1
RecipeConnectString = "SELECT * FROM Recipes WHERE [Recipe_Name] = " & "'" & .Fields("BDSBatch").Value & "'"
Set m_RecipeData = m_MasterDatabase.OpenRecordset(RecipeConnectString)
RecipeCheck = 0
RecCount = RecCount + 1
If m_RecipeData.NoMatch = False Then
x = True
End If
zz = m_RecipeData.Fields("BDSBatch").Value
End With
MsgBox y, vbOKOnly
Loop Until (RecCount > 24) Or (x = True)
If RecCount = 25 Then
GoTo DataRecordError
End If
Do
ConnectString = "SELECT * FROM ZoneData WHERE [ID] = " & RecCount '&" 'TRUE AND [Robot] = 1" '& RobotCount
Set m_ZoneData = m_MasterDatabase.OpenRecordset(ConnectString)
With m_ZoneData
RecipeCheck = 1
RecipeConnectString = "SELECT * FROM Recipes WHERE [Recipe_Name] = " & "'" & .Fields("BDSBatch").Value & "'"
Set m_RecipeData = m_MasterDatabase.OpenRecordset(RecipeConnectString)
RecipeCheck = 0
RecCount = RecCount + 1
If m_RecipeData.NoMatch = False Then
x = True
End If
zz = m_RecipeData.Fields("BDSBatch").Value
End With
MsgBox y, vbOKOnly
Loop Until (RecCount > 24) Or (x = True)
If RecCount = 25 Then
GoTo DataRecordError
End If