PDA

View Full Version : Copying textbox to another form



fatnic
07-04-2008, 10:17 AM
Ok. Im a bit of a newb and this may have been covered many times before, but I'm having trouble finding it!

I've got "Form1" which has a textbox (txtOutput) and a button (cmdOpen) which opens "Form2". This has a textbox (txtInput) which when completed I would like to be copied to txtOutput on Form1 when cmdCopy is pressed on Form2.

I tried

[Forms]![Form1]![txtOutput].Text = Me.txtInput.Text
which produced the error saying I cant reference a property unless it has focus. So I added

[Forms]![Form1]![txtOutput].SetFocus
to the start but am still getting the same error.

Am I missing something simple?

OBP
07-04-2008, 10:30 AM
Forms![Form1]![txtOutput] = Me.txtInput

Should do it.
But can I ask why you are repeating data?

fatnic
07-04-2008, 10:36 AM
That worked a treat. Thanks. What exactly was I doing wrong?

Basically Form2 will build a fault code from dropdown boxes which when complete copies to Form1.

OBP
07-04-2008, 11:11 AM
You had the Forms part in Brackets and also you were using .text which is a field property.

You could have used .value perhaps instead.
I still don't understand why you are copying to Form1 why not have the Combo on Form1 as well?