F
Federico
Help much appreciated:
1. Each record has a unique [GlobalID] in the Samples table.
2. Each GlobalID is associated with several [AliquotBC] in the Aliquots table
Samples Aliquots
---------- ---------
GlobalID <-> GlobalID
AliquotBC
From an unbound form, I need to be able to open and FILTER the Samples form
based on an AliquotBC that the user enters. So far, the form opens but does
not filter the record (GlobalID) based on the AliquotBC:
(...from a select case menu option)
If (IsNull(Me!AliquotBCMethod)) Then
DoCmd.Beep
MsgBox "Please Enter the Aliquot Barcode", vbOKOnly, "Ooops!"
Exit Sub
Else
AliquotBCSelected = Me.AliquotBCMethod
Set dbs = CurrentDb
strSQL = "SELECT Aliquots.AliquotBC FROM Samples INNER JOIN Aliquots
ON Samples.GlobalID = Aliquots.GlobalID WHERE AliquotBC=" & AliquotBCSelected
& ";"
Set rst = dbs.OpenRecordset(strSQL)
If rst.EOF Then
MsgBox "The Aliquot Barcode entered does not exist in StoneBase."
Me.AliquotBCMethod.SetFocus
Exit Sub
Else
'Opens Samples Form
dbs.Close
Set rst = Nothing
'Finds the GlobalID based on the AliquotBC via a new query
strLinkCriteria = "'[GlobalID]= Samples.GlobalID FROM Samples INNER
JOIN Aliquots ON Samples.GlobalID = Aliquots.GlobalID WHERE AliquotBC=" &
AliquotBCSelected & ";'"
DoCmd.Close 'closes FindSamples form
DoCmd.OpenForm "Samples", acNormal, , strLinkCriteria
End If
End If
1. Each record has a unique [GlobalID] in the Samples table.
2. Each GlobalID is associated with several [AliquotBC] in the Aliquots table
Samples Aliquots
---------- ---------
GlobalID <-> GlobalID
AliquotBC
From an unbound form, I need to be able to open and FILTER the Samples form
based on an AliquotBC that the user enters. So far, the form opens but does
not filter the record (GlobalID) based on the AliquotBC:
(...from a select case menu option)
If (IsNull(Me!AliquotBCMethod)) Then
DoCmd.Beep
MsgBox "Please Enter the Aliquot Barcode", vbOKOnly, "Ooops!"
Exit Sub
Else
AliquotBCSelected = Me.AliquotBCMethod
Set dbs = CurrentDb
strSQL = "SELECT Aliquots.AliquotBC FROM Samples INNER JOIN Aliquots
ON Samples.GlobalID = Aliquots.GlobalID WHERE AliquotBC=" & AliquotBCSelected
& ";"
Set rst = dbs.OpenRecordset(strSQL)
If rst.EOF Then
MsgBox "The Aliquot Barcode entered does not exist in StoneBase."
Me.AliquotBCMethod.SetFocus
Exit Sub
Else
'Opens Samples Form
dbs.Close
Set rst = Nothing
'Finds the GlobalID based on the AliquotBC via a new query
strLinkCriteria = "'[GlobalID]= Samples.GlobalID FROM Samples INNER
JOIN Aliquots ON Samples.GlobalID = Aliquots.GlobalID WHERE AliquotBC=" &
AliquotBCSelected & ";'"
DoCmd.Close 'closes FindSamples form
DoCmd.OpenForm "Samples", acNormal, , strLinkCriteria
End If
End If