Main form locks after clicking in subform datasheet

bal123

New member
Local time
Today, 01:13
Joined
Mar 22, 2017
Messages
6
Hi,

I have a really strange problem that I have never encountered in access before.

I am using access 2007 and have a main form with a subform datasheet.

The main form is a stock request and the subform lists items that are requested as stock as part of the main request.

I have add edit and delete buttons on the main form which are working fine. When you press add a add new stock item request form appears (without closing orginal stock request form). When you save the item it closes and updates the subtable in the main form.

Everything works fine and I can add, edit and delete added items from a stock request.

The strange thing is that when I select an item in the subform (which lists the stock request items for the main form) I can no longer edit data on the main form. For examply there is a drop down box listing suppliers on the main form, I can click on it to drop down but cant actually select a supplier. Its like fields for the whole main form become locked.

It is fine when the main form first loads but as soon as I click in the subform, even if there are no records I cant edit anything on the main form. It is like it keeps the focus or something. However I can click on items on the main form, buttons etc work. I just cant edit fields.

This is driving me nuts and been reading different articles on the web to no avail - unless I am not understanding them. :)

Any pointers are sincerely appreciated with this. Many thanks in advance for your kind assistance.

Rgds,
Bal
 
Do you have and code linked to the form's events, i.e LostFocus, AfterUpdate and the like?
 
Hi Nautical Gent,

Thanks for your time to take a look.

The main form which is the stock request has an onload event that generates the stock request number.

The subform has no events associated with it. The add new item button is on the main form and when you click it it opens a add new item form. It does not close the main form. Saving that form goes back to the main form and requeries the subform which then correctly shows the new items for the stock request.

I have played a bit more with it and found that if I do not change the selection in the subform the i can edit items in the main form again.

The problem only occurs when I change selection in the subform OR click on it when it is empty. I can then no longer edit any of the items in the main form, it is as if they are locked.

I made a button that on click it will set focus to a control on the main form to see if that would perhaps force it but it didn't work.

I think it is the behaviour and that there is something I am missing/doing wrong.
 
Without knowing much more, I would try a refresh or requery of the main form. Give it a try and let us know.
 
As the main form adds a new record when you press the save button wouldn't a refresh/requery go to a new blank record/run the create new request number on form load event again?
 
Ok I did an experiment - the problem only occurs on the add new request main form not the edit version of that form.

I tested and removed the onload event which basically:
went to a new blank record acnew; and
created a new ID for the primary key of the main form

Also in the property sheet of the add request form it was set to data entry and only add new records. Edit etc was set to no and also had no record locks.

The edit version of this form I removed the onload event and also changed the data entry and allow additions form property to no and then changed edit property to yes. Changed record locks to edited record.

When I tested with the edit version of the form everything seems fine and works as it should, on this quick test anyhow.

So it is either something to do with the onload event procedure - Which goes to a new blank record and
- Creates the id number

or to do with the form properties that only allow additions and data entry.
 
I don't think so. You are not requerying the form, you are requerying the control (combo box) that you are moving the focus to.
 

Users who are viewing this thread

Back
Top Bottom