DLookup within a sub-form

wllsth

Registered User.
Local time
Today, 04:24
Joined
Sep 17, 2008
Messages
81
I have the following piece of VBA code which is called AfterUpdate

Me.Text62 = DLookup("[Job Desc]", "Projects Extended", "[ProjectID]=" & Nz(Me![Project], 0))

This retrieves Job Desc and puts it in field Text62 on my sub-form. However, when I enter another record with a different ProjectID it displays the new Job Desc for every line of the sub-form.

What am I doing wrong ??
 
If text62 is an unbound control in your subform this is what happens if your subform is a continous form or datasheet. You have to re-think what your goal is with this VBA sub.


JR
 
You're right I think I've sorted it but I am getting a strange error now
'The object doesnt contain the Automation Object "Header" '
Not sure where this is coming from
 
I am using the following bit of VBA code now to retrieve 'Job Desc' onto a line within my sub-form. It retreives it ok but I get the following error message ;-
The object doesnt contain the Automation object 'Header'

Private Sub Project_AfterUpdate()
Me.Job_Desc = DLookup("[Job Desc]", "Projects Extended", "[ProjectID]=" & Nz([Project], 0))
End Sub

Any thoughts !!
 
Looks like there could be someting wrong with a field-reference or maybe the link properties for your subform. google : object doesnt contain the Automation object for some possible answers.

JR:)
 

Users who are viewing this thread

Back
Top Bottom