[AccessD] Not-In-List Popup Form question - SOLVED

Kath Pelletti kp at sdsonline.net
Wed May 21 23:59:02 CDT 2008


Very slick!

----- 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 2:35 PM
Subject: Re: [AccessD] Not-In-List Popup Form question - SOLVED


> Kath
>
> I have the .Cycle property set to 'All Records' because this is the normal
> maintenance form for the manufacturers table, However, your question *did*
> lead me to the answer - OpenArgs!
>
> In the equipment form:
> ...
> DoCmd.OpenForm "frmManufacturers", acNormal, , , acFormAdd,
> acDialog, "AddRecord"
> ...
>
> In the manufacturer form:
> Private Sub Form_Open(Cancel As Integer)
> If Not IsNull(Me.OpenArgs) Then
>     If Me.OpenArgs = "AddRecord" Then
>         Form.Cycle = 1
>     Else
>         Form.Cycle = 0
>     End If
> End If
> End Sub
>
>
> Thank you so much.
> Bob
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti
> Sent: Wednesday, May 21, 2008 23:46 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Not-In-List Popup Form question
>
> 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
>>
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> -- 
> 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