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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining Forms 2

Status
Not open for further replies.

rkd

Technical User
Mar 5, 2000
8
GB
Hello <br>
<br>
I am new to Access<br>
<br>
I have two seperate forms depentent on some values selected in the first a button appears which when clicked takes you to the second form where there are other items to fill out I can get to the second form ok, but I am having trouble making the second form asociate its data with the first and remembering it.<br>
<br>
Many thanks<br>
<br>
Stuart.
 
I have ever done this !<br>
What you do, The macro associated with the button in the first form should not close the first form it should simply call the second form .<br>
Use the expression :<br>
<br>
Forms!newformname!newformcontrol = Forms!oldformname!controlvalue<br>
in a macro and call this macro for the Form Load event . <br>
<br>
eg : Forms!salaryform!empname = Forms!employeeform!empname<br>
<br>
Where ; Oldformname is the name of your First form<br>
: Newformname is the name of the Second form<br>
: Newformcontrolvalue is the field value in the fist form you want to associate./assign to a field value in the second form. <p>Nkabirwa Sowed Magezi<br><a href=mailto:nkabirwa@netscape.net>nkabirwa@netscape.net</a><br><a href= > </a><br>A Ugandan Developer for<br>
(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97<br>
(2)Debt onitoring System(DMS) - Ms-Acess 97<br>
(3) The Loans Recovery System(LS) - Ms- Access 97<br>
(4) The Dry Cleaners System(DS) - Ms- Access 97
 
Thankyou for your reply.<br>
<br>
I am affraid it did not work. I must be doing something wrong, I placed the formula &quot;Forms!AddressForm1!CompanyName = Form!Addresses!CompanyName&quot; in the conditions column of a macro, named it &quot;GetForm&quot; and attached this to the &quot;On Load&quot; of my second form.<br>
<br>
When certain values on my main form (Addresses) are met a button appears which when pressed, loads and take's me to the second form (AddressForm1) this is all working find. on the second form there are various values to fill in, and a box at the top that I want the companyName to appear in, as in the first, just to confirm that this page associated to the first, this I cannot get to happen, plus I cannot get this second form to store any data, dispite the fact it has it's own table what ever I enter for one record is the same for all it does not change. I have created a relationship for these two forms.<br>
<br>
Thanking you in advance<br>
<br>
Stuart
 
Is the primary key/linking value included on the form? You need this to store the data.
 
Yes<br>
<br>
They are linked with a one to many with the one being on the first form and the many on the second.
 
Here's how I would try this, beginning from scratch:<br>
<br>
1. Create a query that includes <b>all</b> the fields that would appear on your second form, including the company name if it is not in the second table.<br>
2. Create the second form (YourFormName) based on that query.<br>
3. Go into design mode on your first form. With the Wizard feature turned on, add a button from the toolbox and select Form Operations/Open Form/YourFormName/Open the form and Find.../etc.<br>
<br>
The wizard should insert all the functionality you need. <br>
Good luck :)
 
Go to the OnClick Property of the button that opens the second form. Click on the &quot;...&quot; and choose Code Builder, then copy and place this code in the space between Private Sub.... and End Sub. it should work for you.<br>
<br>
<br>
Dim stDocName As String<br>
Dim stLinkCriteria As String<br>
<br>
stDocName = &quot;AddressForm1&quot;<br>
<br>
stLinkCriteria = &quot;[CompanyName]=&quot; & Me![CompanyName]<br>
DoCmd.OpenForm stDocName, , , stLinkCriteria<br>
<br>
<p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
To <br>
<br>
Elizaberth & Brian<br>
<br>
Thankyou both very much for your assistance I have done as you said and all is find for now!<br>
<br>
Once again thankyou<br>
Jason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top