Not in List

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi

I have a cobmo box on a from (frmquote) for clients based
on info put in to the table tblclients. What I can't seem
to do is when the client isn't already in the Tblclients
table (that controls my combo box) is get a message box
that pops up and says - not in list - would you like to
add it now ? then If I select yes - it would open the
frmclientdetails (in add mode) and close the Quote form
(frmquote), and If I select cancel then it would clear the
combobox for me to select a client that is there. I know
this is possible - its just driving me mad !!

Thanks for any help you can give me
Mark
 
Hello:

On the Control on "On Not in List" property you need to write some VBA code.

It could be something lile this assuming you have a Combo called "Terms" and
a form "Terms" to add to the relevant table.

Private Sub Terms_NotInList(NewData As String, Response As Integer)
Response = acDataErrContinue
If MsgBox("Would you like to add '" & NewData & "' to the master list of
Terms.", vbQuestion + vbYesNo) = vbYes Then
DoCmd.OpenForm "Terms", , , , , acDialog
Response = acDataErrAdded
End If
End Sub

Regards,

Naresh Nichani
Microsoft Access MVP
 
Back
Top