Hi All
I have a form with 2 controls on it that are sourced from a table. The table is companies we work with and the controls determine which of the list to show depending on Yes/No fields on the record.
Control 1 - Suppliers
Control 2 - Freight Companies
The Companies table is defined as:
ID
Name
isSupplier
isFrieght
The form is to create a new consignment record and the user selects a supplier and the transport company for the record along with a few other items.
The subform is the list of companies that is present to allow the user to add new suppliers or freight companies whilst entering the consignment instead of:
I think i need to check the parent dirty status and do "something" to stop the writing of the partially updated record but i just don't know whether thats the case as i have tried that and it seems not to do anything. Here is the VBA i have so far and whilst it kind of does what i want it also does the writing of a new consignment record when i don't want it to, the consignment record should only be written when the user clicks on the save button on the consignment form
Happy to include anything else that would help (as in forms, table definitions etc etc) and if there is a better way to achieve this i'd appreciate pointers for that
Kind regards
Glen
I have a form with 2 controls on it that are sourced from a table. The table is companies we work with and the controls determine which of the list to show depending on Yes/No fields on the record.
Control 1 - Suppliers
Control 2 - Freight Companies
The Companies table is defined as:
ID
Name
isSupplier
isFrieght
The form is to create a new consignment record and the user selects a supplier and the transport company for the record along with a few other items.
The subform is the list of companies that is present to allow the user to add new suppliers or freight companies whilst entering the consignment instead of:
- Clicking on New Consignment button to open Consignment form
- Clicking on Supplier dropdown
- Finding the Supplier is not listed
- Clicking Cancel
- Going to companies maintenance area
- Adding new company
- Returning to consignments list
- Clicking on New Consignment button to open Consignment form
- Selecting new Supplier as it is now present in the list
- Check whether the form is currently a subform on a parent form
- Check which parent form it is currently on (as i'm planning on enabling this functionality in other areas for customer companies)
- Requery the combo box for Suppliers on the parent form
- Requery the combo box for Freight Companies on the parent form
I think i need to check the parent dirty status and do "something" to stop the writing of the partially updated record but i just don't know whether thats the case as i have tried that and it seems not to do anything. Here is the VBA i have so far and whilst it kind of does what i want it also does the writing of a new consignment record when i don't want it to, the consignment record should only be written when the user clicks on the save button on the consignment form
Code:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Exit
If Len(Me.Parent.Name) > 0 Then
If Me.Parent.Name = "form-Consignment" Then
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
Me.Parent.consignment_supplier_id.Requery
Me.Parent.consignment_freight_info_company_id.Requery
End If
End If
Err_Exit:
End Sub
Happy to include anything else that would help (as in forms, table definitions etc etc) and if there is a better way to achieve this i'd appreciate pointers for that
Kind regards
Glen