Can I send a variable to a text box on a sub form?

homer2002

Registered User.
Local time
Today, 14:35
Joined
Aug 27, 2002
Messages
152
I have a form with a subform
Lets call the subform - frmSUBFORM :-)

in this sub form there is a text box
Lets call the textbox - txtTextBox :-)

Can I pass a variable to this text box

somthing like

frmsubform.txtTextBox.text = MyVariable


Please Help me
 
Hi

The simple answer is yes you can. I'd try;

Forms!FRM_MAIN_FORM!frmSUBFORM.FORM.txtTEXTBOX = MYVARIABLE

Chris


EDIT: SHOULD READ Forms!FRM_MAIN_FORM!frmSUBFORM.FORM.txtTEXTBOX
 
Last edited:
Sorry , can't get it to work (isnt the first bit of code and the edit the same?)


i tried


Forms!frmDataEntry!frmSUBNote.Forms.txtNote = "Hello" (test)


where....
frmDataentry - is the main form that is open
frmSUBNote - is the sub form
txtNote - is a text box in the subform



p.s can you also send "Add new record" code to the sub form?

also can you replace frmDataentry with ME
 
Last edited:
Sorry! Did you read the edit. Lose the "s" on frmSUBFORM.FORM(s)


As for adding a new record.

DoCmd.GoToRecord , , acNewRec

This adds a new record but you have to set the focus to the subform. You could try frmSubform.setfocus but i'm not sure if that works. Try a search on this site.


Chris
 

Users who are viewing this thread

Back
Top Bottom