|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello !
I have the following situation: I have a main form that controls reservations: on this main form I have a combo box from which I select apartaments values (the names) stored in a another table (tblApt). In this main form I have then two sub forms: one for invoices and one for cleaning services. Each time I add a new reservation I get my nice blank fields and I can start adding records on each subform just as I want to (this is to point out to you that all is related to the ReservationID). It is given that I can insert one or more invoices for each reservation and same thing is for cleaningm services. I have an IDApt in the reservation table, the autonumber IDApt in the tblApt and I want to keep an IDApt numeric field in the cleaning table too because I also need to control the adding and deleting of cleaning services independently by the mentioned mainform (I might create anothe rform just for cleaning services). I also would need it for cleaning reports for each apartment. I would like from this main form automatically insert the value of the apartment in the cleaning service IDApt field subform for each cleaning service I have for that given reservation (Say I have 3 cleanings for that reservation). I select the apt from the main form and it sets the same value in the subform for each cleaning chosen. I have accomplished the easy part of inserting the name on the first record in this way: Code:
Private Sub cboApt_AfterUpdate() Form_subMaskPulizie.IDApt = Me.cboApt Form_subMaskPulizie.Refresh End Sub I have had a similar problem recently working on a similar issue. With the same reservationID I had two invoices: deposit and balance. I was calculating the amount form the main form. I was able to insert the value I wanted to add to the Deposit but I didn't know how access the following record related by the ReservationID. What I am not getting is how to get my hands on the single records. I seem to get control of one record but no more. I think Iwells showed me the path once but I am still not getting. I thank you in advance. |
|
#2
|
|||
|
|||
|
ItalianLodging
I really got lost in trying to understand your table relationships and your question. Which table is the one and which table is the many? From what I can tell, it would be just a matter of setting up relationships between your cleaning table and your apartment table and that would automatically add the aptID, but not following your table relationships it's hard to tell for sure. If you already have it structured that way, are the Master/Child Link fields between your subforms and main form set up? Or have I misunderstood your question all together? lwells |
|
#3
|
|||
|
|||
|
Insert same value in multiple record
Hello Iwells
I have attached a sample DB sorry if I haven't been too precise. |
|
#4
|
|||
|
|||
|
Hi ItalianLodging,
Take a look at the database and see if this is what you were looking for. I made the field IDApt default to the IDApt selected in the main form. I also set the Enabled to No and Locked to Yes so that no changes can be made to the IDApt in the subform. I changed the relationships slightly and setup another column in your invoices to show the balance due after a payment was made. So as a payment is made the remaining balance will show on the form automatically. I also changed the two buttons to calculate the downpayment and remaining balance based on the new column. I added a field to the tblApt for the Rental Amount. I wasn't sure if the rental amount is something that is fixed or negotiated, so you will have to decide if this can be used. If it is negotiated, then you will probably need to change things back to the way they were, and add a field in your tblReservations to hold the amount that is negotiated. Then change where the calculations take their values to the this field instead of the tblApt like I have it set now to calculate correctly with the negotiated amount rather than the fixed amount. Or you can add another field to the reservation table and set the control to default what was in the tblApt Rental Amount. Then you have a suggested rental amount based on the table tblApt, and a field to enter what the negotiated amount was (if different) so that you have both displayed at the same time on your form. lwells Last edited by lwells : January 19th, 2005 at 02:11 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Insert same value in multiple record |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|