Command Button to Set Field Value (1 Viewer)

Hydra427

Registered User.
Local time
Yesterday, 23:32
Joined
Mar 9, 2012
Messages
40
I have two forms (main form & boxes) when form "boxes" is open I want to be able to press a command button and enter a set value in the "main form" for the Field "box type" on the current open record. Can someone please help solve this small problem?
 

John Big Booty

AWF VIP
Local time
Today, 13:32
Joined
Aug 29, 2005
Messages
8,263
The following should do the trick;
Code:
Forms![YourMainFormName]![YourMainFormControlName] = Me.[ControlNameThatHoldsValueYouwishToTransfer]
 

Hydra427

Registered User.
Local time
Yesterday, 23:32
Joined
Mar 9, 2012
Messages
40
John, Thanks but let me give you a little more detail if you can help me out.

Form1 is a form that contains cars
Form2 is a form that contains boxes

I have Form1 set as the main form, when it is open and I am entering data I get to a text box for "box type" I am using the got focus to open Form2 that contains all the different boxes that are available for the cars. I want to be able to click on a picture of the box and have that insert a value (as an example "B4") into "box type" on Form1, and then close itself. Do I need to have the Forms linked as this is probably a one to many possibility?

I've tried macros and VBA code but am still learning, Please help if you can!

Thanks, John
 

John Big Booty

AWF VIP
Local time
Today, 13:32
Joined
Aug 29, 2005
Messages
8,263
In the On Click event of your image put the following;
Code:
Forms![Form1]![Box Type] = "B4" [COLOR="SeaGreen"]'Or whatever text you wish to insert[/COLOR]
DoCmd.[URL="http://msdn.microsoft.com/en-us/library/bb226008%28v=office.12%29.aspx"]Close[/URL] acForm, "Form2"
 

Hydra427

Registered User.
Local time
Yesterday, 23:32
Joined
Mar 9, 2012
Messages
40
John, your the "MAN" Thanks for all your help, such a simple solution when all is said and done. I'm sure I'll have many more questions before this project is done!!!!

Thanks Again, John
 

Users who are viewing this thread

Top Bottom