please help

waylander32

Registered User.
Local time
Today, 18:34
Joined
Oct 20, 2010
Messages
20
HI
hoping someone can help me
I hope this will make sense

I have a form that calculate the price of a job ( using a query to retrieve and calculate the data )

This form is used in two main forms ( as a subform ). The fields that need to be passed to the query are the same on each of the main forms

The only solution I can think off at the minute is to create another query and another subform but would rather avoid this. I have tried creating a public function that takes the criteria from the open form ( which is below ) but it won't work.

Function getjobref() As String
getjobref = Forms(Screen.ActiveForm.Name).JOB_REF.value

End Function

VBA is not my strong point

any idea would be appreciated
 
If your main form has the field that would provide the link to the sub forms data then you can just insert the sub form into the main form and use the Link Master Field and the Link Child field properties of the sub form to link the data in the sub form to the record in the main form.
 
thanks fro the reply

I have tried that
the subform is linked via unique reference so that the jobs codes it pull up match are the correct ones for that job. The price of the job is dictated by the client and I couldn't get it to link to both

so i need to put a criteria in the query which pulls from the main form

hope that makes sense
 
Without seeing exactly how your database is designed, it is not possible to provide specific information about how to retrieve the correct data but if your data is normalized properly, I would think that you should be able to link a sub-form to the main form using the appropriate master and child properties.
 

Users who are viewing this thread

Back
Top Bottom