![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
If you want immmediate confirmation of the possible duplicate, all you need to do is to use the after update event of the control(s) involved to search the table for an existing value. If Me.NewRecord Then If DCount("*","NameOfJoinTable","InventoryID=" & txtINventoryID & " AND CustomerID = " & txtCustomerID)>0 THEN MsgBox "This Customer already has this item" 'Choose one of the following or do something else. 'Me.Undo 'Undo the entire form 'Me.txtInventory.Undo 'Undo just the control End if End If |
#12
| |||
| |||
|
|
One option might be to change the recordsource of the continuous form to a query that includes both the subform's table and the customer table. In the query, you can create a calculated field that has the same expression as the combo's display column. Now you can put a text box bound to this expression on top of the combo, and size it so the combo's drop-down still appears to the right. In the text box's GotFocus, SetFocus to the combo. The trick is that the combo jumps in front of the text box only on the selected row. In this way, you can exclude the client from the combo's RowSource, so the user can't select it, and yet still display the client on all other rows of the continuous form (since the text box on top has that info.) |
|
While I've used that technique for other purposes, I doubt I would be so concerned about the timing of preventing the client, but I recognise that's a stylistic issue. |
#13
| |||
| |||
|
#14
| |||
| |||
|
|
Did you set the Cancel parameter value to true, like I did? If so, what type of other saving errors are getting? |
![]() |
| Thread Tools | |
| Display Modes | |
| |