A
Afrosheen via AccessMonster.com
Thanks for reading this.
Here is the code I'm using:
Private Sub Combo109_NotInList(NewData As String, Response As Integer)
Dim strMsg, nm1, stwhere As String
10 strMsg = "That value is not in the list. Are you sure you want to add
it?"
20 If MsgBox(strMsg, vbYesNo + vbDefaultButton2) = vbYes Then
30 Response = acDataErrAdded
40 CurrentDb.Execute ("insert into tblsupervisor(Supervisor) select '" &
NewData & "'as exprl;")
nm1 = Me.[Supervisor]
stwhere = "nm1=supervisor"
MsgBox nm1
DoCmd.OpenForm "frmsupervisor", , , stwhere
50 Else
60 Response = acDataErrContinue
70 Me.Combo109.Undo
80 End If
end sub
Here's what it's doing. When I enter info in the combo box and it's not found
it does fire the not in list and adds the information to the table. What I
want it to do is to have it open a form and have it display the name I typed
in the combo box because there's other information I need to add. Before it
opens the form it asks for the parameter value of the nm1 string. After I
enter that then it will open the form with the parameter value. The msgbox
nm1 does not show the info in the combo box. It shows the previous name. The
field name is "Supervisor". For example:
I type Tom
The name before was George. The msgbox nm1 shows George. Not Tom.
I hope I've explained my self correctly.
Thanks for your help.
Here is the code I'm using:
Private Sub Combo109_NotInList(NewData As String, Response As Integer)
Dim strMsg, nm1, stwhere As String
10 strMsg = "That value is not in the list. Are you sure you want to add
it?"
20 If MsgBox(strMsg, vbYesNo + vbDefaultButton2) = vbYes Then
30 Response = acDataErrAdded
40 CurrentDb.Execute ("insert into tblsupervisor(Supervisor) select '" &
NewData & "'as exprl;")
nm1 = Me.[Supervisor]
stwhere = "nm1=supervisor"
MsgBox nm1
DoCmd.OpenForm "frmsupervisor", , , stwhere
50 Else
60 Response = acDataErrContinue
70 Me.Combo109.Undo
80 End If
end sub
Here's what it's doing. When I enter info in the combo box and it's not found
it does fire the not in list and adds the information to the table. What I
want it to do is to have it open a form and have it display the name I typed
in the combo box because there's other information I need to add. Before it
opens the form it asks for the parameter value of the nm1 string. After I
enter that then it will open the form with the parameter value. The msgbox
nm1 does not show the info in the combo box. It shows the previous name. The
field name is "Supervisor". For example:
I type Tom
The name before was George. The msgbox nm1 shows George. Not Tom.
I hope I've explained my self correctly.
Thanks for your help.