UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> pass ifnformation from one form to another    
 
   
favor08
post Dec 11 2006, 09:50 AM
Post #1

UtterAccess Guru
Posts: 753



If I have one form open and then I give the user the option to open another form to allow then to keep adding comments and see histroical comments, how can I pass some of the information from the first form to the second.

What I want to have happen is when they go to click on past comments I only want the comments to show that match that primarykey,

So I have a primary key(that I create based on some info) on the first form and I want to pass that primary key to the second form each time the go to add comments an only given day.

Then when they want to see the history for that primary key I can create a command button and make me.primarykey = newprimarykey and have the second form open and only show the data where the primarykeys match.
Go to the top of the page
 
+
Alan_G
post Dec 11 2006, 10:01 AM
Post #2

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,882
From: Devon UK



You can use something like this in the On Click event of your command button......

Docmd.Openform "YourFormName",,,"RecordID = " & Me.RecordID
Go to the top of the page
 
+
ScottGem
post Dec 11 2006, 10:01 AM
Post #3

UtterAccess VIP / UA Clown
Posts: 25,021
From: LI, NY



There are two possibilites. You can reference a value on any open form using the syntax:

=Forms!formname!controlname

You can also pass a value in the OpenArgs argument of the OpenForm method.

If you just want to filter the second form so that the corresponding records open, you can use the WHERE clause of the OpenForm method.
Go to the top of the page
 
+
BrianS
post Dec 11 2006, 10:01 AM
Post #4

UtterAccess VIP
Posts: 5,597
From: St. Louis, MO



Use the record source of the second form to control this

Select * From YourHistoryTable Where YourForeignKey = [Forms]![YourFirstForm]![txtYourPrimaryKey]
Go to the top of the page
 
+
favor08
post Dec 11 2006, 10:47 AM
Post #5

UtterAccess Guru
Posts: 753



does anyone have an example?
Go to the top of the page
 
+
BrianS
post Dec 11 2006, 12:20 PM
Post #6

UtterAccess VIP
Posts: 5,597
From: St. Louis, MO



Here is an example using both the "Recordsource" method that I described as well as the "Filter" method described by Alan

I like the recordsource method better because a filter can simply be removed by the user.

Open "frmPerson" to view the example.
Attached File(s)
Attached File  example.zip ( 23.42K ) Number of downloads: 3
 
Go to the top of the page
 
+
favor08
post Dec 11 2006, 04:41 PM
Post #7

UtterAccess Guru
Posts: 753



HEre is an example. Open fpastduecomments. then click on the note paid. this will open the other form and I am trying to pass the mainkey form the pastduecomments form to the pasduediarySub form. I get an sytanx error. I want it to go to the unbound text box then once the pre-fill the other info the can add the record and it will append to the table which will house the history.
Go to the top of the page
 
+
favor08
post Dec 11 2006, 04:44 PM
Post #8

UtterAccess Guru
Posts: 753



sorry
Attached File(s)
Attached File  example.zip ( 268.17K ) Number of downloads: 1
 
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 11:35 PM