Using DoCmd.OpenForm method with a mainform and subform

J

John S. Ford, MD

I'm using DoCmd.OpenForm to open a mainform and its subform using a WHERE
statement from a command button on another form:

DoCmd.OpenForm "frmMainForm", , , WHERE statement, acFormReadOnly

I want the user to only be able to read the record in the mainform without
editing or adding a new record.

However, I want the SUBform to be in acFormAdd datamode, that is I want my
user to be able to read the previous records in the subform using the
navigation
buttons and be able to add new records.

How can the datamode argument of the OpenForm method be different for the
Mainform and the subform?

Thanks in advance!

John
 
K

Ken Snell \(MVP\)

You probably will need to use VBA to toggle the "AllowEdits" property of the
subform to Yes or No, using the subform control's Exit and Enter events.
 

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