The TOP two lines in EVERY module should be
Code:
Option Compare Database
Option Explicit
This would show you the error:
Code:
Private Sub Form_Current()
Dim lngVal As Long
lngVal = Forms!Quote_Main!Materials.Form!LstParts
Forms!Quote_Main!Materials.Form!LstParts.Requery
Forms!Quote_Main!Materials.Form!LstParts = Nz(DLookup("Mat_ID", "LSTMaterial_Updated", "[Mat_ID] = " & lngValue), Forms!Quote_Main!Materials.Form!LstParts.ItemData(0))
End Sub
Notice anything??? Like the names????
If you press select part again, It will add that same part again.
Once you select an option in the list box, the value stays until you change it even if the list box is refreshed
Try this: Open the Materials" form in Design view.
Just below the "Remove Part" button, add an unbound text box. Set the CONTROL SOURCE to "=[LstParts]" (no quotes)
Save and close. Open the form "Quote_Main". Select a category, then click on an option. The text box should show a number.
Click on the "SELECT PART" button. Did the number in the text box go away?
Somehow the value for the list box needs to be cleared.
I NEVER use macros, so I don't know to clear the value.
In VBA it is very simple......