Hi all,
I'm a bit rusty. I have a form that displays jobs, and their details. I have a Combo control that lists the existing Job Ids and navigation code that selects the appropriate record from the underlying query.
I've also got code attached to NotInList so that when a new Job ID is added, a confirmation is requested, and then the new JobID is added to the Jobs table via
This makes sure the Combo list is updated with the new job the user has entered, but the record displayed on the form is not the new job they've just added. Plus, they can't select the new job from the Combo control - it's just ignored. I presume I have to refresh the underlying query, but whatever I try leads to primary key errors. I'm trying to do a Me.Requery after the dbs.Execute in the code above.
What should I be doing?
I'm a bit rusty. I have a form that displays jobs, and their details. I have a Combo control that lists the existing Job Ids and navigation code that selects the appropriate record from the underlying query.
I've also got code attached to NotInList so that when a new Job ID is added, a confirmation is requested, and then the new JobID is added to the Jobs table via
Code:
Private Sub JobCombo_NotInList(NewData As String, Response As Integer)
Dim dbs As Database
Dim ClientDesc
NewData = UCase(NewData)
If MsgBox("That job process doesn't exist. Create new job process?", vbYesNo) = vbYes Then
Set dbs = CurrentDb
dbs.Execute "INSERT INTO Jobs (Job, Client) VALUES ('" & NewData & "', '" & ClientDesc & "')", dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
What should I be doing?