G
Guest
I have the below code in the Not in List function of my database
Private Sub Combo17_NotInList(NewData As String, Response As Integer
Dim strsql As String, x As Intege
Dim LinkCriteria As Strin
x = MsgBox("Do you want to add this value to the list?", vbYesNo
If x = vbYes The
strsql = "Insert Into T_Names ([Stud_Name]) values ('" & NewData & "')
'MsgBox strsq
CurrentDb.Execute strsql, dbFailOnErro
LinkCriteria = "[Stud_Name] = '" & Me!Combo17.Text & "'
DoCmd.OpenForm "F_MaintainNames", , , LinkCriteri
Response = acDataErrAdde
Els
Response = acDataErrContinu
End I
End Su
I have the tables T_Names (fields: Stud_Name and Stud_ID) and T_Car (fields: Stud_ID, Make, Model etc). My main form is basically used as a search function for the names table with a combo box for selecting the record by the persons name, and also has a textbox that is updated with a corresponding Stud_ID value when the name is selected. THe subform, which is used to update data into the Car table, automatically moves to the corresponding record when it is selected, also showing the same Stud_ID that is shown in the previously mentioned text box in a different text box
Now, when i use the MaintainNames form to update the names and stud id when they are not found in the list, the data gets added to the T_Names table, but it is not reflected on the form anywhere unless i close the form and reopen it. I have tried various requery functions but still cannot get it to work. What i want to happen is when i exit the MaintainNames form, the name should be in the combo box and when selected it should function as per normal, ie. the Stud-ID text boxes should be updated and ready for data entry! Can anyone help me!!!
Private Sub Combo17_NotInList(NewData As String, Response As Integer
Dim strsql As String, x As Intege
Dim LinkCriteria As Strin
x = MsgBox("Do you want to add this value to the list?", vbYesNo
If x = vbYes The
strsql = "Insert Into T_Names ([Stud_Name]) values ('" & NewData & "')
'MsgBox strsq
CurrentDb.Execute strsql, dbFailOnErro
LinkCriteria = "[Stud_Name] = '" & Me!Combo17.Text & "'
DoCmd.OpenForm "F_MaintainNames", , , LinkCriteri
Response = acDataErrAdde
Els
Response = acDataErrContinu
End I
End Su
I have the tables T_Names (fields: Stud_Name and Stud_ID) and T_Car (fields: Stud_ID, Make, Model etc). My main form is basically used as a search function for the names table with a combo box for selecting the record by the persons name, and also has a textbox that is updated with a corresponding Stud_ID value when the name is selected. THe subform, which is used to update data into the Car table, automatically moves to the corresponding record when it is selected, also showing the same Stud_ID that is shown in the previously mentioned text box in a different text box
Now, when i use the MaintainNames form to update the names and stud id when they are not found in the list, the data gets added to the T_Names table, but it is not reflected on the form anywhere unless i close the form and reopen it. I have tried various requery functions but still cannot get it to work. What i want to happen is when i exit the MaintainNames form, the name should be in the combo box and when selected it should function as per normal, ie. the Stud-ID text boxes should be updated and ready for data entry! Can anyone help me!!!