Quick help please

maGemme

Registered User.
Local time
Yesterday, 20:15
Joined
Mar 24, 2010
Messages
62
Hi, I have a form and a subform

Very simple thing I'm trying to do but my code doesn't work, would someone correct it please.

I just want to copy the data that's in a text box on my subform to a text box on my main form.

here's my code :

Forms![frmMenu]!txtQuestion.value = Forms![frmMenu]![frmQuestions]!txtQuestID.value

Thanks!
 
Code referring to subforms is special. You need to use this to refer to a control on the subform:
Code:
Forms!MainFormNameHere.SubformControlHere.Form.ControlNameHere
So, the SubformControlHere part refers to the name of the subform control which houses the subform on the main form. You don't use the subform name itself but instead the name of the control (unless the subform and the control are named the same).

The .Form. part tells Access you want something on the subform itself as opposed to the subform control.

you might read this tutorial which might shed some more light on using subforms.
 
Thanx again for your help Bob, that tutorial was great. I've always had problems with subform referencing, this guide helps alot!

It now works perfectly, here's my code just in case it helps someone else :

Forms!frmMenu.txtQuestion.value = Forms!frmMenu.frmQuestions.Form.txtQuestID.value

Cheers!
 

Users who are viewing this thread

Back
Top Bottom