Open Form/Subform Read Only?

B

Brook

Good Day All,

I have a command button to open my frminvoices in read only mode:
** Begin Code **

DoCmd.OpenForm FormName:="frmInvoices", WindowMode:=acDialog,
OpenArgs:="ReadOnly"

** End Code **

and the following code within my frminvoices:
** Begin Code **
If Me.OpenArgs = "ReadOnly" Then
Me.RecordsetType = 2
End If

** End Code **

Everything is working fine in order to provide read only on the form, but
the subform: frminvoicedetailssubform is still able to be edited? How can I
make this read only as well?

Thanks,

Brook
 
T

tina

try adding to the code on the form's Load event, as

If Me.OpenArgs = "ReadOnly" Then
Me.RecordsetType = 2
Me!SubformControlName.Form.RecordsetType = 2
End If

if Access isn't happy with that for some reason, try

If Me.OpenArgs = "ReadOnly" Then
Me.RecordsetType = 2
Me!SubformControlName.Locked = True
End If

hth
 
B

Brook

Tina,

Thanks... that worked perfectly... I used the first code and it accepted it
ok.

Brook
 

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