[AccessD] Check Subform for NotNull

Steve Schapel miscellany at mvps.org
Tue May 29 16:18:03 CDT 2007


Virginia,

Here is yet another idea to play with...  Don't 'lock' the subform. 
Just require the entry of a password for editing the existing record.

On the Before Update event of the subform, something like this...

If Not Me.NewRecord Then
    If InputBox("Enter password for edit") = "xyz" Then
       ' proceed
    Else
       Cancel = True
       Me.Undo
       Msgbox "Incorrect password"
    End If
End If

Regards
Steve


Hollis, Virginia wrote:
> I have a form and a subform where the users want the subform locked if a
> record has been entered. They do not want it to be changed once data has
> been entered. They can add new records, just not edit existing records.
> 
>  
> 
> Then I have the problem - 'what if they make a typo' and discover it
> after the record has been entered and locked. They only want a
> supervisor to be able to go back, unlock the record on the subform and
> make the change.
> 
>  
> 
> I tried the below code OnOpen of the Main form, but receive an error.
> 
>  
> 
>     If
> IsNotNull(Forms!frm_InventoryMain.frm_InventorySubform.InventoryID) Then
> 
>         Forms!frm_InventoryMain.frm.InventorySubform.Form = Locked
> 
>     Else    
> 
>  
> 
>     End If
> 
>  
> 
> Virginia
> 



More information about the AccessD mailing list