Subform loosing connection to form when using query instead of tbl for the fields??

Takstein

Registered User.
Local time
Today, 07:37
Joined
Jan 31, 2007
Messages
54
Hi everybody!

I have a problem that is way past my understanding of access at the moment. I will do my best to explain and hope somebody has any ideas!

I have a form ProjectManager which is based on the table tblProjects and tblDeliverables (one project can have many deliverables). The subform is based on tblDeliverables. These two are working well together. BUT, ofcourse I want to include som fields in the subform together with tblDeliverables from another table tblWeekly, where I can sum up some used hours. This I had to solve by using a "make table" query as I was not able to update values in the subform when it was a normal query. Anyways, I got this to work.

But now (After thinking I actually solved this) i cannot enter any new records in the subform tblDeliverables without it giving me the errormessage that i also have to put a value in the projects field! (This does not come up when the form is based only on tblDeliverables).

So it seems that when i base the subform on a "make table" query, the connection with the main form is lost? Anybody know a work around for this?
I've uploaded some images, hope you understand my question!
 

Attachments

Without looking at your file, you're form (query) "master" field is not the same as the subform "child" field.
 
Without looking at your file, you're form (query) "master" field is not the same as the subform "child" field.

Thank you for your reply!

Isn't it? I thought if the link master fields and link child fields was set up it would work?

The subform query was based on tblDeliverables(i just added two summary fields from another query ). And it works just fine if I change it back to be based on tblDeliverables..

Maybe there's a link somewhere i don't understand?
 

Attachments

  • linkMasterChild.jpg
    linkMasterChild.jpg
    100.5 KB · Views: 99
i solved it with a work around!

it seems when i base the sub form on a table it automatically updates the child fields with value of which the master is linked (and this was not visible in my form).
But this does not happen when i change the field list on the sub form to a query.

So what i did was to make a vba line on AfterUpdateon the child entry.

Private Sub Deliverable_AfterUpdate()
On Error GoTo ErrorHandler

Project.Value = Me.Parent.ID.Value

Exit Sub
ErrorHandler:
MsgBox Err.Number & ", :" & Err.Description

End Sub


and then it worked!
 

Users who are viewing this thread

Back
Top Bottom