Link to home
Start Free TrialLog in
Avatar of Alaska Cowboy
Alaska CowboyFlag for United States of America

asked on

Subform won't allow updates

I have a subform that is not connected to the main form, they each read separate tables. They're displayed on the same page.

If  I run the subform by iteself, I can update data.

But as part of the main form, the subform doesn't allow updates, although on the main form you can make updates.

The main form has allow edits, don't allow deletions or additions. Same with the subform.

So I am baffled why I can't update the subform?

Any ideas?
SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>by checking the subform control's master/child links in the main form's design view?

Do this by selecting the subform in the mainform's design and looking in the properties window -> Data tab -> Master Links andChild Links
Avatar of Alaska Cowboy

ASKER

mbizup, yes, I did check the master link and at first they were linked by ID, but then I took that out and verified it. (thanks for the clarification on how to do this).
Have you also made sure that the subform control (as seen in the main form's design) is enabled and not locked?
enabled = yes
locked = no

baffling. thanks for the advice.

The form is a tabbed form with one subform.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Still baffling . . .

I only want 1 record in the table, so in the subform

AllowEdits = Yes         \
                                  \
AllowAdditions = No     / ---- works when running the subform by itself
                                 /
AllowDeletions = No   /

Avatar of puppydogbuddy
puppydogbuddy

when subform run by itself, it is unbound and has no link to main form.that is why it works.
I've been trying to recreate this problem on a test form... to no avail.  By "unable to update" do you mean:

- Able to edit but unable to save
or
-Unable to edit at all
?
thanks for trying.

the field is not editable, it's locked. I can click in it but can't change data.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Aha ! Good question

The main form has AllowEdits = No.

But in the Load event, if [such and such], I say AllowEdits = Yes.

So this works for the main form (allowing and not allowing edits), but saying AllowEdits in code doesn't translate to the subform.

In the properties of the main form I said "AllowEdits = Yes", now I can edit the subform !

So how do I get edits in the subform under this situation:

Start out mainform, allow_edits = No

In load event, if {true condition}, then allow_edits = yes
        *** Now what to allow edits in the subform??? ***

In the subform, it's always allow edits = yes, set as a property.
I can turn around my code to do it, will do so now.
Ok, I reversed the code and allow edits to start, then turn off. It works great but my original dilemma wasn't solved, but it's not an issue now.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I didn't think I'd have to do that. Also, with the Me.subform.form I don't think you get the "intelli-sense", so I try to avoid wrestling with subforms if I can. I use them a lot but it can be tricky. Thanks for your help.
Glad to help!

>Also, with the Me.subform.form I don't think you get the "intelli-sense"...
This is true.  However, if you have a vague memory of what your subform control names are, go ahead and type them in lowercase.  If you are on the mark, they will automatically be converted to the correct case when you move on to the next line of code.  If they stay in lowercase, you know you need to refresh your memory fron the form's design ;-)  

It's not quite intelli-sense, but it's the next best thing!
Ok, good tip. thanks.