making a form & subform read / write

J

JulieD

Hi All

i have a form with a subform .. on opening the form is set to allow edits /
allow additions & allow deletions as NO ... however i've just added an EDIT
RECORD button that on press changes the allow edits / allow additons to YES
... works fine, however, i can't get the subform to behave.

The subform's allow edits / allow additions & allow deletions are set to YES
all the time .. but on open you can't add a record to the subform, so i'm
guess it inherits some of its behaviour from the main form ... but when i
change the main form's properties to yes the subform still won't allow
additions ... any ideas?

Cheers
JulieD
 
A

Allen Browne

Hi Julie

The subform has its own AllowEdits properties etc:

Private Sub cmdAllow_Click()
Dim bAllow As Boolean

If Me.Dirty Then
Me.Dirty = False
End If

bAllow = Not Me.AllowEdits

Me.AllowEdits = True
Me.AllowDeletions = bAllow
Me.AllowAdditions = bAllow

With Me.frmInvoiceDetail.Form
.AllowEdits = bAllow
.AllowDeletions = bAllow
.AllowAdditions = bAllow
End With
End Sub
 
J

JulieD

Hi Allen

thanks for this .. .i had actually tried it this way but was referring to
the subform by the wrong name (didn't create the database - just helping a
friend out on one for a charity ... you know the thing and didn't realise
that they had left spaces in their object names)

But thanks for the code it's a lot neater than how i was doing it.

Cheers
JulieD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top