[AccessD] Not-In-List Popup Form question

Stuart McLachlan stuart at lexacorp.com.pg
Thu May 22 00:32:44 CDT 2008


This is one of the rare occasions where I go unbound.  Pop up a  simple  form with a few 
unbound text boxes including OK and Cancel buttons, Fill in the appropriate box with the 
NewData when you open it.

Behind the OK button,  validate and save the data, tell the originating form that the data has 
been updated (global variable or set a value in the Tag of the originating  form)  and finally 
close the form.

-- 
Stuart

On 21 May 2008 at 23:39, Bob Gajewski wrote:

> 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





More information about the AccessD mailing list