VB code says can't find Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is the code below of the part where it is giving me the message below.
Does anyone know what this error message would mean?

Code:
Forms![FormInterviewCalender2]![Subform4MonthStatus].InterviewID =
Forms![FormInterviewCalender2].TextWhichId

Error:
Behavioral Health Lab Database can't find the form 'FormInteviewCalender2'
referred to in a macro expression or Visual Basic code
 
pokdbz said:
Here is the code below of the part where it is giving me the message
below. Does anyone know what this error message would mean?

Code:
Forms![FormInterviewCalender2]![Subform4MonthStatus].InterviewID =
Forms![FormInterviewCalender2].TextWhichId

Error:
Behavioral Health Lab Database can't find the form
'FormInteviewCalender2' referred to in a macro expression or Visual
Basic code

It would normally mean that you misspelled the name of the form or that the form
is not currently open.
 
That is what I thought also but everything is spelled right. The only thing
that might be different is the .InterviewID in the field it is interviewId
but when I put it into the statement below it capializeds the I and D. Would
this be the problem.


Rick Brandt said:
pokdbz said:
Here is the code below of the part where it is giving me the message
below. Does anyone know what this error message would mean?

Code:
Forms![FormInterviewCalender2]![Subform4MonthStatus].InterviewID =
Forms![FormInterviewCalender2].TextWhichId

Error:
Behavioral Health Lab Database can't find the form
'FormInteviewCalender2' referred to in a macro expression or Visual
Basic code

It would normally mean that you misspelled the name of the form or that the form
is not currently open.
 
pokdbz said:
That is what I thought also but everything is spelled right. The only thing
that might be different is the .InterviewID in the field it is interviewId
but when I put it into the statement below it capializeds the I and D. Would
this be the problem.

I didn;t see the subform referecne before. Your syntax for that is incorrect.
Generically the syntax for a control on a subform is...

Forms!NameOfParentForm!NameOfSubformCONTROL.Form.ControlName

Notice the all-caps portion. It is not guaranteed that the name of the subform
control will be the same as the form refenced within it. The syntax needs the
name of the control. Also note the "dot-Form" that follows the name of the
subform control. That has to be there.
 
What is NameOfSubformCONTROL what would that be in my statement. I am
confused about this part. I think that the rest is right could you check it
over for me to see if that is right?

Forms!FormInterviewCalender2!?????.form.interviewId
 
pokdbz said:
What is NameOfSubformCONTROL what would that be in my statement. I am
confused about this part. I think that the rest is right could you check it
over for me to see if that is right?

Forms!FormInterviewCalender2!?????.form.interviewId

Go to your parent form in design view an *single click* the subform. What you
see as the "Name" property in the property sheet is what you need in your syntax
as the subform control name.
 
Hi,
When you select a subform from your toolbox and place it on a form,
what you've placed there is a container or control that will eventually
'contain' your subform (which will be the Source Object). The container and the subform do not neccessarily have the same name.
Use the name of your 'container' control, not the name of the subform.
 
Back
Top