Can't get subform calculation to display in parent

R

Ripper

I've written a function that figures number of days from a given date. It
works well, but I am trying to make if fly from within a subform and make it
plug the result into a field in the parent form and I'm not getting the
syntax right. Everything within the If statement works, but the last
statement generates a missing object error. The whole statement is
highlighted in the editor, so I'm not sure which part is the offending part.
Can someone help? Many thanks!

Rip



If Not IsNull(DLookup("BusDayLimit", "qryTimeLimits", _

"[HearingType] = '" & Forms!frmMain!frmHearings.Form.HearingType & "'"))
Then

lngNumDays = DLookup("BusDayLimit", "qryTimeLimits", _

"[HearingType] = '" & Forms!frmMain!frmHearings.Form.HearingType & "'")

Else: MsgBox "Data Error! Last day calculation failed. ", vbExclamation,
"Data Error"

End If





Forms!frmMain!frmHearings.Form!LastDate = _

CalcLastDay(Forms!frmMain!frmHearings.Form!ReviewDate, lngNumDays, _

db.Properties("bWeekends"), db.Properties("bHolidays"))
 
D

Damon Heron

Try:
Me.Parent!HearingType
if the code is in the subform and you are referring to a control on the
mainform.

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top