Move data between Subform and Form

rgreene

Registered User.
Local time
Today, 12:14
Joined
Jan 22, 2002
Messages
168
I have a form with a subform and the subform lists a 5 digit code. I want to be able to click on the 5 digit code in the subform and have that number moved/copied to a field on my main form.

Any suggestions?

P.S. I'm new to Access so detailed explanations would be greatly appreciated.

Thanks in advance,

Rick
 
Rick,

Something like this might work...

Private Sub yourField_Click()

Forms!yourMainForm!YourTextboxOnMainForm.SetFocus
Forms!test1!YourTextboxOnMainForm.Text = yourField.Text

End Sub

so the code goes in the click event of the field in your SUBFORM. When you click on the field focus is set to the textbox where you would like the code to be moved to. The last line sets the main form's textbox to equal the code in the subform.

Try it and let me know if that's what you wanted.

Rich
 
This is what I put (I put it in the Double Click instead of Click)

Private Sub PACCode5_DblClick(Cancel As Integer)

Forms!Unassigned Cost Codes Form!PAC5Code.SetFocus
Forms!test1!PAC5Code.Text = PACCode5.Text

End Sub

I get Compile Error

Syntax error
and the first line (Forms!.......) has red text.

Where did I goof?
 
Pat that worked GREAT!!! THANKS!!!

Your However paragraph was that geared to me or the first response post? As I said in my original post I'm just trying to learn some of this stuff. There is probably o alot of things I've done that don't make sense.
 

Users who are viewing this thread

Back
Top Bottom