Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send data from one form to another

Status
Not open for further replies.
Apr 24, 2003
22
GB
Hi,
Anything anyone could suggest here would be greatly appreciated.
I am creating a database of a questionaire. On the first form the user will enter their personal details such as name, position and which region within the Uk they work and for which branch. The second form will be for them to select which trust they work for and also which branch. I dont want them to re-select which branch they work for so i want to be able to carry the details of the branch they selected on the first form to the second form and have the Id code put into this table also. There may be several trusts for each branch. With the questions I have the same problem as I want the branch at which they work to be stored but i would prefer it if the value was just taken from the earlier form and carried accross so when they answer the questions the branch code will be in the table along with their answers.

Thank you in advance for anything anyone can suggest.[dazed]
 
In Access there are many ways to skin a cat. Here is one...

(Im assuming form two will only be opened from form one)
1. Open the second form in design view.
2. Go to the branch field.
3. Open the properies window for this field.
4. Put this
=Forms![MainFromName]![Branch]

Do the same for any other field you want to automatically receive a value from the main form.

I hope this helps...




ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Hi Lonnie,
Thanks for that. I feel a bit stupid but what is a branch field? I put the syntax you gave me into the text box i was using and whe i ran it it just said #Name?
Thanks for this
[dazed]
 
In your explaination, you said one of the fields that the user inputs data into on the main form was for the "branch". You also indicated that this field (control, be it text box or combo box) was also on the second form. I am talking about whatever the control is for the "branch" that you are speaking about.

I did notice that I failed to tell you to put that expression in the second form's "branch" control's default property.

Sorry for any confusion.





ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Sorry my mistake,
do you mean put the statement into the Default Value of the Properties box ?
What would be the row source? I did have this in the row source and it wasn't working. By using a intermediate table I could show just this but the code for it would not be entered into the table below.
Sorry for lack of clarity.
Thanks [dazed]
 
Sounds like you are using a combobox or listbox on the second form. You can leave the rowsource the same as you had it at first. That's if you want them to be able to change whatever the default value is that populates for a new record. And note this only works for new records on the second form. If you don't want them to be able to change what the default value that we are setting, then you many want to change the combo (or listbox) to a text box and lock it.

And yes to your question asking if you should put the expression I gave you in the default value of the "branch" box of the second form.


I hope I am getting you closer.



ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Hi,
I have done all that and changed the combo box to a text box and it still comes up with #Name? instead of the name of the "Branch"?
would it need to be put into the form properties in VB ?
Thanks
[dazed]
 
What do you have as the control source?
What is the name of form number one and the name of the box that has the branch in it on form number one?
Are you closing form one before form two opens? If so then form two does not know where to get the information from.


ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Thankyou, Thankyou, Thankyou!!!!!!
It works.
I had the first form closing and hence couldn't find the field.
thankyou again that is really great!!
[bigsmile] [bigsmile] [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top