Hi,
I have this below code to add the data that is not in the tbl but it is for single field. Is it possible to make it for one other field in the same table. I have Added another field name in table Called SectionName. I want the code to ask me SectionName also while adding newdata in. Becuase my table have new field now which is SectionName
Private Sub CboDept_NotInList(NewData As String, Response As Integer)
Dim NewHRSQL As String
Dim P As Integer
Dim msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
msg = "'" & NewData & "' Department is not in the list." & vbCr & vbCr
msg = msg & "Do you want to add it?"
P = MsgBox(msg, vbQuestion + vbYesNo, "New Destination...")
If P = vbYes Then
NewHRSQL = "Insert Into T_Dept ([CDeptarments]) values ('" & NewData & "')"
CurrentDb.Execute NewHRSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
Is it possible or I have to place another combo and write separate similar code?
Please advise.
Thanks in advance.
Ashfaque
I have this below code to add the data that is not in the tbl but it is for single field. Is it possible to make it for one other field in the same table. I have Added another field name in table Called SectionName. I want the code to ask me SectionName also while adding newdata in. Becuase my table have new field now which is SectionName
Private Sub CboDept_NotInList(NewData As String, Response As Integer)
Dim NewHRSQL As String
Dim P As Integer
Dim msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
msg = "'" & NewData & "' Department is not in the list." & vbCr & vbCr
msg = msg & "Do you want to add it?"
P = MsgBox(msg, vbQuestion + vbYesNo, "New Destination...")
If P = vbYes Then
NewHRSQL = "Insert Into T_Dept ([CDeptarments]) values ('" & NewData & "')"
CurrentDb.Execute NewHRSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
Is it possible or I have to place another combo and write separate similar code?
Please advise.
Thanks in advance.
Ashfaque