• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

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?
0
Alaska Cowboy
Asked:
Alaska Cowboy
  • 9
  • 7
  • 2
4 Solutions
 
mbizupCommented:
Have you verified that there are truly no connections between the two forms by checking the subform controls master/child links in the main form's design view?  If the subform were selected from the database window and "dropped" into the main form's design, Links would automatically be defined between common fields in the two forms' recordsources (such as ID).  Another possible culprit in this problem might be unbound controls used in the master child links...
0
 
mbizupCommented:
>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
0
 
Alaska CowboyAuthor Commented:
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).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mbizupCommented:
Have you also made sure that the subform control (as seen in the main form's design) is enabled and not locked?
0
 
Alaska CowboyAuthor Commented:
enabled = yes
locked = no

baffling. thanks for the advice.

The form is a tabbed form with one subform.
0
 
puppydogbuddyCommented:
Bill,
if you are adding records with the subform,  allow additions should be yes for subform.

                           PDB
0
 
Alaska CowboyAuthor Commented:
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   /

0
 
puppydogbuddyCommented:
when subform run by itself, it is unbound and has no link to main form.that is why it works.
0
 
mbizupCommented:
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
?
0
 
Alaska CowboyAuthor Commented:
thanks for trying.

the field is not editable, it's locked. I can click in it but can't change data.
0
 
mbizupCommented:
Is there any code in the main form that may be affecting this?  Any code that loops the form controls...
0
 
Alaska CowboyAuthor Commented:
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.
0
 
Alaska CowboyAuthor Commented:
I can turn around my code to do it, will do so now.
0
 
Alaska CowboyAuthor Commented:
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.
0
 
mbizupCommented:
Bill-- also to explicitly turn edits on for a subform, you can do this:

Me.subfrmYourSubform.Form.AllowEdits = true

0
 
Alaska CowboyAuthor Commented:
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.
0
 
mbizupCommented:
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!
0
 
Alaska CowboyAuthor Commented:
Ok, good tip. thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 7
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now