zelarra821
Registered User.
- Local time
- Today, 15:03
- Joined
- Jan 14, 2019
- Messages
- 813
Hi guys. I want to add items to a combo box if it's not in it.
This is the code:
When I try it, adding some item that I know is not in the list, it tells me that it is not in the list. Now if I try a Me.CmbName.Requery it tells me that it has to save the record first. So I don't know what I can do to fix it. Could someone tell me how to fix it?
Thank you.
This is the code:
Code:
Dim ctl As Control
Set ctl = Me.Articulo
If MsgBox("Value is not in list. Add it?", vbYesNo, NombreBD) = vbYes Then
Response = acDataErrAdded
CurrentDb.Execute "INSERT INTO TArticulos (Articulo) VALUES ('" & NewData & "')"
Else
Response = acDataErrContinue
ctl.Undo
End If
When I try it, adding some item that I know is not in the list, it tells me that it is not in the list. Now if I try a Me.CmbName.Requery it tells me that it has to save the record first. So I don't know what I can do to fix it. Could someone tell me how to fix it?
Thank you.