Opening another form inside the Main form

M

ML

I have posted an earlier question but needed revision to it.

I have 1 main form (DataEntry) and multiple read-only forms. I am able to
open the read-only forms on click of the combo-box in the DataEntry form
using the following code:

Public Sub DataEntry_AfterUpdate()
DoCmd.OpenForm DataEntry.Value
End Sub

I have 2 questions that need expert's help:
1) How to open the read-only forms in a specific area in the Main form
(DataEntry)?
2) I want to be able to continue to do data entry or select a new drop-down
in the Main form (DataEntry). Currently, I am not able to do after opening
the read-only form.

Appreciate someone to help me. Thanks in advance!
 
K

Klatuu

For starters, change the name of your form. DataEntry is an Access reserved
word and using a reserved word as a name can cause problems. Access may get
confused about whether you are addressing the form or the DataEntry property.

As to opening forms at a specific spot on your main form, they have to be
subforms. You specify the location of a subform during form design.

As to this line:

DoCmd.OpenForm DataEntry.Value

It really makes no sense. What is DataEntry other than the name of your
form? As written, it appears you also have a control named DataEntry. A
control on a form with the same name as the form is a really bad idea. In
addition, the Value property is not required. It is the default property of
a control.

Before you can worry about whether you can enter new data, you need to get
your form and subforms working first.
 
M

ML

I think I was trying to indicate the main form is a data entry form. My form
name is MHTeams. Also, I didn't specify clearly states that the Main form:
MHTeams has a combo-box which has the Row Source of the 15 forms.

I have 15 other forms which would be viewed based on the selection I choose
on the combo-box on the Main form: MHTeams.

I don't want to view all the 15 subforms at the same time.

Thanks in advance.

ML
 
K

Klatuu

Your code to open a form appears to be correct provided your combo box name
is DataEntry.

DoCmd.OpenForm DataEntry.Value

But, you don't need to use Value.

I don't know why you can't enter data in the other forms, but you might
check the form's Allow Additions and Allow Edits properties. They should
both be set to Yes assuming you want to allow new records to be entered and
existing records to be edited.

If the form you want to open is a subform, it will inherit the properties of
the parent form and also be read only.

I don't know for sure, but you may try setting the data mode in the OpenFrom
method.
 

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