[AccessD] Not In List Not the Right Solution

Bill Patten bill_patten at embarqmail.com
Tue Apr 9 11:45:27 CDT 2013


Rocky,

This is how I did it, I'm sure you can improve on it.

Bill

Private Sub cbofindSerial_NotInList(NewData As String, Response As Integer)
  On Error GoTo Err_cbofindSerial_NotInList
  Dim intAnswer As Integer
  Beep
  intAnswer = MsgBox(NewData & "is not in your records, do you want to add 
it?", vbQuestion + vbYesNo)
  If intAnswer = vbYes Then
    cboFindSerial = Null
    ' part of trying to make sure new trunked radios are logged in 
correctly. 10/03/2010
    intYNNew = MsgBox("Is this a Trunked Radio?", vbYesNo)
    cboFindCust.Enabled = True
    txtSN.Enabled = True
    DoCmd.GoToRecord , , acNewRec
    [SERIAL] = NewData
    cboFindCust.SetFocus
    Response = acDataErrContinue
  Else
    Response = acDataErrDisplay
    Me!cboFindSerial = Null
    Me!cboFindSerial.SetFocus
  End If

Exit_cbofindSerial_NotInList:
  Exit Sub

Err_cbofindSerial_NotInList:
  MsgBox "Error " & Err.Number & ": " & Err.Description & " In Sub 
cbofindSerial_NotInList In Module Form_frmEquipment" & vbCrLf
  Resume Exit_cbofindSerial_NotInList

-----Original Message----- 
From: Rocky Smolin
Sent: Tuesday, April 09, 2013 9:23 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Not In List Not the Right Solution

Dear List:

I have a request from a user that when they try to find a name in a combo
box if the name is not there, that the program go to add a new record and
place the data entered in the combo box in the last name field and let them
finish entering the new data.

I tried the NotInList event until I realized this is to add entries to the
combo box.  But I can't seem to get it to behave properly - it goes into a
loop displaying my "add then new guy now?" not in list message.

I think Not In List is not the best way to do this, but don't know how else.

Any ideas?

MTIA

Rocky Smolin
Beach Access Software
858-259-4334
www.bchacc.com <http://www.bchacc.com/>
www.e-z-mrp.com <http://www.e-z-mrp.com/>
Skype: rocky.smolin

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com 



More information about the AccessD mailing list