JoD said:
Here is my test code: [...]
With objAppt
.Start = Me!txtExamDate & " " & Me!txtScheduledStartTime
.duration = DateDiff("n", Me!txtScheduledStartTime,
Me!txtScheduledEndTime)
'With Me.Parent
.Subject = Me.Parent!txtFirstName & " " &
Me.Parent!txtLastName & " " & Me.Parent!txtCourseName
strLocation = Me.Parent!cboExamAudioFormat & " " &
Me.Parent!cboExamVisualFormat & _
" " & Me.Parent!cboComputer & " " &
Me.Parent!txtScribe
.Location = strLocation
'End With [...]
End With
The error occurs at the following line
.Subject = Me.Parent!txtFirstName & " " &
Me.Parent!txtLastName & " " & Me.Parent!txtCourseName
if I activate the "With Me.Parent...End With" section and replace
"Me.Parent" with "!". It works if I run it with the "With" section
commented.
Do you mean you had something like this as your code:
With Me.Parent
.Subject = !txtFirstName & " " & !txtLastName & _
" " & !txtCourseName
strLocation = !cboExamAudioFormat & _
" " & !cboExamVisualFormat & _
" " & !cboComputer & " " & !txtScribe
.Location = strLocation
End With
? Because if so, there's bound to be confusion as to what object .Subject
and .Location belong to. VBA will think they belong to Me.Parent, and they
don't. You would need to write this:
With Me.Parent
objAppt.Subject = !txtFirstName & " " & !txtLastName & _
" " & !txtCourseName
strLocation = !cboExamAudioFormat & _
" " & !cboExamVisualFormat & _
" " & !cboComputer & " " & !txtScribe
objAppt.Location = strLocation
End With
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)