I
Italian Pete
Hi,
I have an loans form divided into two. In the first part of the form,
the user inputs the dates of the loan and the name of the loanee. In the
second part of the form, there is a subform containing a table where details
of kit loaned is input.
On clicking an "Add Kit" button, a child form opens where, via a series of
combo boxes, an item of kit can be selected. On the PARENT form, there is a
button which executes the following code to write a new record to the subform
table:
Private Sub cmdSelectKit_click()
'go to new record in table
Forms!frmBooking!sbfrmTempLoansTable.SetFocus
DoCmd.GoToRecord , , acNewRec
'write new values into the table from the childform "frmChooseKit"
Forms!frmBooking!sbfrmTempLoansTable!equipment_id =
Forms!frmChooseKit!CboNumber
Forms!frmBooking!sbfrmTempLoansTable!EquipmentType =
Forms!frmChooseKit!cboKitType
Forms!frmBooking!sbfrmTempLoansTable!RDFIDCode =
Forms!frmChooseKit!cboAvailableKit
Forms!frmBooking!sbfrmTempLoansTable!Number = Forms!frmChooseKit!CboNumber
End Sub
This piece of code works.
However, when I try to put this code into a button on the CHILD form, the
first part (going to the new record) doesn't work.
Can anyone shed some light onto why this might be?
Many thanks,
Pete
I have an loans form divided into two. In the first part of the form,
the user inputs the dates of the loan and the name of the loanee. In the
second part of the form, there is a subform containing a table where details
of kit loaned is input.
On clicking an "Add Kit" button, a child form opens where, via a series of
combo boxes, an item of kit can be selected. On the PARENT form, there is a
button which executes the following code to write a new record to the subform
table:
Private Sub cmdSelectKit_click()
'go to new record in table
Forms!frmBooking!sbfrmTempLoansTable.SetFocus
DoCmd.GoToRecord , , acNewRec
'write new values into the table from the childform "frmChooseKit"
Forms!frmBooking!sbfrmTempLoansTable!equipment_id =
Forms!frmChooseKit!CboNumber
Forms!frmBooking!sbfrmTempLoansTable!EquipmentType =
Forms!frmChooseKit!cboKitType
Forms!frmBooking!sbfrmTempLoansTable!RDFIDCode =
Forms!frmChooseKit!cboAvailableKit
Forms!frmBooking!sbfrmTempLoansTable!Number = Forms!frmChooseKit!CboNumber
End Sub
This piece of code works.
However, when I try to put this code into a button on the CHILD form, the
first part (going to the new record) doesn't work.
Can anyone shed some light onto why this might be?
Many thanks,
Pete