ACCESSING SUB FORM CONTROLS in adp

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

Guest

Hi all

I placed a form on a form using the subform wizard. but i did not link both forms as the data displayed in the subform is requeried from the main forms combo which gets data from a different table. Now I want a value displayed in that subform(if can call this as subform) to be inserted to main forms text box. Iam not getting though I use Me.Subformcontrolname!textboxname orMe.Subformcontrolname.form!textboxname . Access is saying that i am trying to insert null though value is displayed in the subform

What is the way out

It appeared to have worked some time back

Thanks in advanc
 
If by Subformcontrolname you mean the name of the subform, and if
textboxname is the name of the textbox on the subform, then this is the
correct syntax for accessing a control on a subform, so it is hard to say
what the problem could be without looking at the form.
I would doublecheck the spelling.

Ragnar
 
H
Here the problem is it is not a subform in the true sense because, i did not link both the forms. what iam doing is i am taking a unbound combo box in the main form wherein i retrived a value from another table. now i would just place the fom on the main form( say sub form for now). This sub fom has the datasource a query which takes input parameter from the unbound comboform. and diplays the data . Now a value in the text box should be inserted to a text feild in the main form which iam unable to do. it is saying that the null is trying to be inserted though the value in the sub form is diplayed

any clu

R.D.CHETTY
 
A subform does not have to be linked to be considered a subform. If it is
placed on another form it is still a subform.
If the code belongs to the main form, the correct addressing is
Forms!MainFormName!SubformName.Form!SubFormControlName, or the shorthand
form
Me.SubformName.Form!SubFormControlName

How are you inserting the value? Are you copying it in an event procedure or
are you making the textbox on the main form a calculated control?

Ragnar
 
Si

I am inserteing a value from subform to main form using a varible in the code behind the main form
Say
var = subfompat
me.maintextbox = va

I would like to mention here that , since i deleted the subform and inserted again it is not working though the control name is same

Thanks
R.D.CHETT
 
Ttry using the Debug.Print to record the value you are getting from the
subform
Insert this line in your code before you are assigning the value to the main
form textbox
Debug.Print Me.SbformName.Form!SubformTextBoxName
After you get the error message, open VB editor window, and select
View/Immediate window.
You will see what value was returned from the subform

BTW, what datatype is the var declared as?

What event procedure is the code for

Ragnar
 
Back
Top