setting a keyID in new form, then setting image related to keyID - Null problem


Hi I am stuck -
I am opening a new (child) form in Add mode
Setting this childID, from the parentID from previous form
Setting childID back to parent form for later reference.
Once the child form has opened, and ChildID has been set from parentID
I have an image on child form that must be displayed. then
looked up related image path in another table that related to ParentID then, I set the image.picture property to my path (//..../images/thisimg.jpg)
so onload event on child form is going to do this.

pretty simples.

but what is happening Im getting an error Invalid Use of NULL on my Dlookup line.

What I guess is happening is that because the ChildID in the child form I have just only set - it does not exist in the table record for the Dlookup to have anything to lookup.

I have tried forcing a requery on the newly set ChildID to update the record set. but thats not working. and dont know how to proceed.
I just need to force the underlying record to be updated with the ID,
any advice on best way to do this.

'on form load of the child form

Dim ImageLogoPath As String
ImageLogoPath = DLookup("[logofilepath]", "Tbl_lk_Products", "[ProductID] = Forms![Frm_ExtendedProductCostsChild]![ProductID]")
Me.Image1.Picture = ImageLogoPath

'does not work as the ProductID does not exist yet following its 'insertion' from click event in previous form

many thanks
Jon

Perhaps you could driving it off the parent form. If you are displaying the child form as a result of clicking a button, include in there the code. You will need to alter the image assignment statement

Me.mysubform.Image1.Picture = ImageLogoPath