Hi Everyone,
I have a form with combobox which has a corresponding customer part number for our own partnumber.
When a customer part number which does not exist in the combobox is entered, the "AddNewCustPartNo" form will pop up. The idea is to have the NewData(the new customer part number) already filled in when the form pops up and fill in the rest of the form manually.
However, when the AddNewCustPartNo pops up, the field is not filled in with the NewData. Below is my code and can anyone tell me what's wrong with the code?
------------------------------------------
I have a form with combobox which has a corresponding customer part number for our own partnumber.
When a customer part number which does not exist in the combobox is entered, the "AddNewCustPartNo" form will pop up. The idea is to have the NewData(the new customer part number) already filled in when the form pops up and fill in the rest of the form manually.
However, when the AddNewCustPartNo pops up, the field is not filled in with the NewData. Below is my code and can anyone tell me what's wrong with the code?
------------------------------------------
Code:
Private Sub CustPartNo_NotInList(NewData As String, Response As Integer)
Dim ButtonClicked
ButtonClicked = MsgBox("The customer part number " & _
NewData & " , doe not exist. Do you wish to add " & _
NewData & " to the customer's part list?", vbYesNo)
If ButtonClicked = vbNo Then
CustPartNo.Undo
Response = acDataErrContinue
Else
Response = acDataErrAdded
DoCmd.OpenForm "AddNewCustPartNo", , , , acAdd, acDialog, NewData
CustPartNo.Undo
CustPartNo.Requery
CustPartNo = DLookup("CustPart_ID", "CustPartNo", "CustPart_No= '" & NewData & "'")
End If
End Sub
Last edited: