I have designed a search for that i use to search a ProjectNo and the search function works perfect but i have ADD button that adds a value to the list box so i can search that value on a fly. but it doesnt add the value to the list box im not sure why. the code for the the Add button is as follows.
Private Sub cmdAdd_Click() Dim SQL As String Dim CID As Long
On Error Resume Next If IsNull(Forms!frmPLCProject1!ProjectID) Then MsgBox "No current customer record open" Exit Sub End If
'To check if the record set already exist in the list so we dontr have duplicates -------------
CID = Nz(DLookup("ProjectID", "ProjNoSearchT", "ProjectID=" & Forms!frmPLCProject1!ProjectID), 0) If CID <> 0 Then MsgBox "Customer already exists in search list" Exit Sub End If
With Forms!frmPLCProject1 SQL = "INSERT INTO ProjNoSearchT (ProjectID, ProjectNo, Technician,) " & _ "VALUES (" & !ProjectID & ", #" & !ProjectNo & "#, """ & _ !Technician & """)" End With DoCmd.SetWarnings False DoCmd.RunSQL SQL DoCmd.SetWarnings True ProjNoList.Requery
End Sub
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.