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

Open from 1 form, a new form where new displays info based on the 1st

Status
Not open for further replies.

ianohlander

Programmer
Feb 28, 2002
12
0
0
US
::hooking subject line was difficult::

Ok, I'm new and did check the FAQ and went back about 7 pages to see if there was anything I could use.

Basically, my problem is this:

I am working on a reservations DB. All my tables are in order and linked appropriately. But my data I want entered from forms. So I have a createCustomer form (and a view customer form) and from there want to go to a viewReservation form. This form displays that customer's name and any reservations they might have made. I have a subform that takes care of the second part, that is, it shows all reservations made to that customer ID. But How do I get the original forms (createCustomer or viewCustomer)to open the viewReservations form to either that existing customer's record in the form (and thus his reservations using my subform), or to create a new record with the new customer's ID, ready for reservations to be added?

Confusing? In other words, after a customer has been created or selected from a list, I want to press a button and that persons' viewReservation form (not record) come up (with my subform showing any res they might have made.)

Unrelated to this, I also need to be able to have a running total that adds up all costs for the spaces they have reserved. So that if they reserved one space, it just gets the total from that record. But if they reserved 5 spaces, it gives a total for ALL of those.

Thank you in advance for any assistence you can offer. And I apologize if I have done the newbie thing and not gone back far enough in seeking out my answers.

Ian
 
Typically, when you create a button (and have the wizard turned on), you'd select Form Operations -> Open Form, the next screen would say something like 1) Open Form and Show All Records or 2) Open Form and Find Specific Data. Select #2. It will now ask you to "tie" the two forms together (probably on your CustomerID field). Finish clicking through and you should be all set.

Alternately, you can create a button (manually), and on the On Click property, type:

Private Sub <form name>_Click()
[this would be your customer entry form]

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = &quot;<target form name>&quot;
[This would be your reservation form]

stLinkCriteria = &quot;[customer_id]=&quot; & Me![customer_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top