Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform protected 1

Status
Not open for further replies.

kimsMTC

Programmer
May 30, 2007
50
US
I have a form that allows the user to enter information and click the ADD button. The ADD button adds the information to a specific table. I then requery a subform on the page to show the newly added record has been added to the list of previously added records.

I need to be able to click on the subform and delete the row I clicked in. My DELETE button is on the form, not the subform. I have AllowEdits=Y and AllowDeletes=Y. My problem is that my subform is protected, appears to be a read-only. My RecordSet=dynaset. The only way I can click in the subform is by setting DataEntry to Yes, but then it won't retrieve existing records into the subform.

How can I display all records previously added and still delete a record should the user decide it is necessary?

Thanks,

Kim
 
One thought: When you click that delete button on your main form you switch focus back to the main form so it is trying to delete a record there?

Second thought: you aren't setting and looking at the subform properties, just the main form.
 
I continually try to click inside the subform and nothing happens. Focus cannot shift to that area. I am looking at hte subform properties because as I change different options, it changes the subform. Any other ideas?

Thanks for your response though,

Kim
 
Can you open the subform base form on its own and make changes?
 
Yes, I opened it separately and I can modify, etc. What does that mean?
 
If you can make data changes deletes etc. to the subform when it is opened independently it means it should behave the same as a subform. Typically, 'modify' means design changes as that is what the modify permission controls.

That is unless the subform control has properties set.

Perhaps you have the enabled property on the control set to no or the locked property set to yes?

Selecting the control can be tricky... If you can move the subfrom you have the control selected.
 
Woops...

Typically, 'modify' means design changes as that is what the modify permission controls.


That is an afterthought that breaks the continuity of what I meant. It should read:

If you can make data changes deletes etc. to the subform when it is opened independently it means it should behave the same as a subform. That is unless the subform control has properties set.
 
Enabled = yes and Locked = no. I'm very familiar with selecting objects, etc., so I know I have the control selected. I'm still at a loss...
 
You can edit and delete records in the subform when opened on its own.

That means it is not the form properties or the recordsource.

Hmm... I am at a loss. Try deleteing the subform control and readding it.
 
I deleted and added back and still have the same problem. It has to be in my code. I've checked all my code and nothing is disabling or locking the individual fields or the form itself. Is there a combination of settings that may have caused this that I am unaware of?
 
Evidently there is some combination of settings. Problem is it has me too.

What version of Access are you using? Is it fully patched?

Are you using master and child fields?

If there is no odd code on the main form how about the subform?
 
One more thought...

Can you edit data if you add the subform to a new unbound form?
 
This is driving me insane! OK, if I create a new form and add this subform, it works great!

To answer your other question, I started out linking the subform and form, but later I realized I didn't need to do that, so I deleted the Master and Child fields, but it still doesn't work.
 
Just for grins rename the original form to something else and see if it works. If so, rename the unbound form to the oringinal name.

Are you setting any Control properties on the main form?

If so, what does the code look like?

Barring any of that being helpful:

Throw in the kitchen sink...

1 Compact and Repair
Test

2 <AccessPath\>Msaccess.exe "<Path And Filename of Database>" /decomplie
Test

3 Compact and Repair
Test

4 Import all objects into clean database file
Test
 
I finally found the problem, but I don't know how to fix it! My main form is a data entry form and inserts records into my TIME table. ProjectID is a required field on that table. For some reason, this window is making my subform a read-only window until I select a ProjectID value from the drop down list. Once I have a ProjectID selected, I can click in the subform. How do I fix this? Sometimes a user will only want to delete a record from the subform. The user may not need to add one.

Thanks!

Kim
 
Even MORE info...I have the following code in my BEFOREUPDATE event to prevent the app from trying to add a blank record when I'm clicking on the subform. Is there another way to do this that accomplishes the same thing, but lets focus transfer to the subform?

Private Sub Form_BeforeUpdate(Cancel As Integer)

If ProjectID.Value = 0 And Hours.Value = 0 Then
Cancel = True
End If

End Sub
 
Without rereading the entire thread, I think you said there are no master and child fields and the subform is not related to the present mainform in anyway.

In this case, remove the subform from the mainform and use both as subforms on an unbound mainform. I think that should work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top