Hi is there any way to make a selection disappear on the continueous form once its been selected? So when they go to the next line, what they selected previously no longer shows up as a choice.
Ludwig Willems
@Reply 2 years ago
create your query, then adjust the code for form, field names & combo box for yourself
query
SELECT ProductID, ProductName
FROM Products
WHERE ProductID NOT IN (SELECT ProductID FROM OrderDetails WHERE OrderID = Forms!frmOrders!OrderID);
dan in form current:
Private Sub Form_Current()
Call RequeryComboBox
End Sub
Private Sub cmbProducts_AfterUpdate()
Call RequeryComboBox
End Sub
Private Sub RequeryComboBox()
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.ControlType = acComboBox Then
If ctrl.Name = "cmbProducts" Then
ctrl.RowSource = "SELECT ProductID, ProductName FROM qryAvailableProducts"
ctrl.Requery
End If
End If
Next ctrl
End Sub
Kevin Robertson
@Reply 2 years ago
I would add a Yes/No field to the table. In my example I named my field IsVisible in my Order table.
Add this field to your Query and set the criteria to True.
I also added a button to show ALL records.
Modify the code to your specific needs.
Example code:
Private Sub HideRecords(ShowRecord As Boolean)
If ShowRecord Then
CurrentDb.Execute "UPDATE OrderT SET Isvisible=True"
Else
CurrentDb.Execute "UPDATE OrderT SET Isvisible=False WHERE OrderID=" & OrderID
End If
Me.Recordset.Requery
End Sub
Private Sub Form_Current()
HideRecords False
End Sub
Private Sub btnShowAllRecords_Click()
HideRecords True
End Sub
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 7.