Kath Pelletti
kp at sdsonline.net
Wed May 21 22:45:36 CDT 2008
Bob - Do you have the 'cycle' property on the popup form set to 'Current record' as opposed to 'All Records'? Kath ----- Original Message ----- From: "Bob Gajewski" <rbgajewski at adelphia.net> To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Sent: Thursday, May 22, 2008 1:39 PM Subject: [AccessD] Not-In-List Popup Form question > Hi Folks - me again :( > > I am trying to figure out how to handle NotInList code to popup a form for > adding the new record; allowing the addition of only 1 record; then > closing > the popup and returning the added value. > > I have an equipment table, and one of the fields is for the manufacturer. > My > code below opens the form, allows for the addition of any number of > entries, > then when manually closed it leaves the original value that fired the NIL > event. I can live with the manual popup form close, but I really want to > only allow a single record addition. > > Any suggestions are much appreciated! > > Regards, > Bob Gajewski > > > ============================================================================ > ========= > > Private Sub EquipmentManufacturerID_NotInList(NewData As String, Response > As > Integer) > Dim db As Database, rs As Recordset > Dim strMsg As String > strMsg = "'" & NewData & "' is not in the Manufacturers table. " > strMsg = strMsg & "Would you like to add it?" > If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, "Add Manufacturer") Then > Response = acDataErrDisplay > Else > On Error Resume Next > DoCmd.OpenForm "frmManufacturers", acNormal, , , acFormAdd, acDialog > DoCmd.Save > If Err Then > MsgBox "An error occurred. Please Try Again." > Response = acDataErrContinue > Else > Response = acDataErrAdded > LastUpdated = Date > End If > Me!EquipmentManufacturerID.Requery > End If > strMsg = "" > End Sub > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >