Access 2010 in 2007 mode.
I have a subform with bound fields that are controlled by the main form’s combo box. Most fields (except the key fields) I am able to update. My customer had me add a button to display other data in the subform and I have that working except now the recordset is not updateable.
How do I make the recordset updateable when I change the recordsource? This is what I am using:
Forms!frmBaseRouteAssignment.[RouteEfficiencyDetail].Form.RecordSource = "SELECT tblPartRouteAssignment.Route," _
& " tblPartRouteAssignment.PartNumber, tblPartRouteAssignment.Station, tblPartInfo.Description," _
& " IIf([StationBld_Rate]=0,[VerifiedBld_Rate],[StationBld_Rate]) AS Bld_Rate, tblPartInfo.PackDensity," _
& " tblPartInfo.Container, tblPartRouteAssignment.ReceivingDock, tblPartRouteAssignment.LineFeedDeliveryType, tblPartRouteAssignment.TravDistLineFeed," _
& " tblPartRouteAssignment.TravDistStaging, tblPartRouteAssignment.TravDistDock, tblPartRouteAssignment.StackHtLFDelivery," _
& " (([LineFeedHandling]/[StackHtLFDelivery])+([StagingHandling]/[StackHtReceiving])+([EmptyReturnHandling]/[StackHtReceiving])) AS HdlgPerCont," _
& " (([TravDistLineFeed]/[StackHtLFDelivery])+([TravDistStaging]/[StackHtReceiving])+([TravDistEmpty]/[StackHtReceiving])) AS TravelPerTrip," _
& " [TravelPerTrip]*0.00227 AS TravelMinPerTrip, [HdlgPerCont]+[TravelMinPerTrip] AS AllocPerCont, tblPartRouteAssignment.LFAllocation," _
& " tblPlantInfo.WorkingMinPerShift, tblPartRouteAssignment.PlantCode, tblPartRouteAssignment.DefinedInKanban" _
& " FROM (((tblPartRouteAssignment INNER JOIN tblPlantInfo ON tblPartRouteAssignment.PlantCode = tblPlantInfo.PlantCode)" _
& " INNER JOIN tblLinefeedHandling ON tblPartRouteAssignment.LineFeedDeliveryType = tblLinefeedHandling.LineFeedType)" _
& " INNER JOIN tblPartInfo ON (tblPartRouteAssignment.ModelYear = tblPartInfo.ModelYear)" _
& " AND (tblPartRouteAssignment.PlantCode = tblPartInfo.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartInfo.PartNumber))" _
& " INNER JOIN tblPartStation ON (tblPartRouteAssignment.ModelYear = tblPartStation.ModelYear)" _
& " AND (tblPartRouteAssignment.PlantCode = tblPartStation.PlantCode)" _
& " AND (tblPartRouteAssignment.PartNumber = tblPartStation.PartNumber) AND (tblPartRouteAssignment.Station = tblPartStation.Station)" _
& " ORDER BY tblPartRouteAssignment.Route, tblPartInfo.Description;"
Then I reassign the ControlSource for 4 fields:
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtFullStorage.ControlSource = "TravDistLineFeed"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtLineStaging.ControlSource = "TravDistStaging"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtEmptyStorage.ControlSource = "TravDistDock"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtDockReturn.ControlSource = "StackHtLFDelivery"
When I first go into the form the subform fields are editable but after the click event where I change the records source they are not.
How do I approach updating the key fields? Any suggestions?
Joel
I have a subform with bound fields that are controlled by the main form’s combo box. Most fields (except the key fields) I am able to update. My customer had me add a button to display other data in the subform and I have that working except now the recordset is not updateable.
How do I make the recordset updateable when I change the recordsource? This is what I am using:
Forms!frmBaseRouteAssignment.[RouteEfficiencyDetail].Form.RecordSource = "SELECT tblPartRouteAssignment.Route," _
& " tblPartRouteAssignment.PartNumber, tblPartRouteAssignment.Station, tblPartInfo.Description," _
& " IIf([StationBld_Rate]=0,[VerifiedBld_Rate],[StationBld_Rate]) AS Bld_Rate, tblPartInfo.PackDensity," _
& " tblPartInfo.Container, tblPartRouteAssignment.ReceivingDock, tblPartRouteAssignment.LineFeedDeliveryType, tblPartRouteAssignment.TravDistLineFeed," _
& " tblPartRouteAssignment.TravDistStaging, tblPartRouteAssignment.TravDistDock, tblPartRouteAssignment.StackHtLFDelivery," _
& " (([LineFeedHandling]/[StackHtLFDelivery])+([StagingHandling]/[StackHtReceiving])+([EmptyReturnHandling]/[StackHtReceiving])) AS HdlgPerCont," _
& " (([TravDistLineFeed]/[StackHtLFDelivery])+([TravDistStaging]/[StackHtReceiving])+([TravDistEmpty]/[StackHtReceiving])) AS TravelPerTrip," _
& " [TravelPerTrip]*0.00227 AS TravelMinPerTrip, [HdlgPerCont]+[TravelMinPerTrip] AS AllocPerCont, tblPartRouteAssignment.LFAllocation," _
& " tblPlantInfo.WorkingMinPerShift, tblPartRouteAssignment.PlantCode, tblPartRouteAssignment.DefinedInKanban" _
& " FROM (((tblPartRouteAssignment INNER JOIN tblPlantInfo ON tblPartRouteAssignment.PlantCode = tblPlantInfo.PlantCode)" _
& " INNER JOIN tblLinefeedHandling ON tblPartRouteAssignment.LineFeedDeliveryType = tblLinefeedHandling.LineFeedType)" _
& " INNER JOIN tblPartInfo ON (tblPartRouteAssignment.ModelYear = tblPartInfo.ModelYear)" _
& " AND (tblPartRouteAssignment.PlantCode = tblPartInfo.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartInfo.PartNumber))" _
& " INNER JOIN tblPartStation ON (tblPartRouteAssignment.ModelYear = tblPartStation.ModelYear)" _
& " AND (tblPartRouteAssignment.PlantCode = tblPartStation.PlantCode)" _
& " AND (tblPartRouteAssignment.PartNumber = tblPartStation.PartNumber) AND (tblPartRouteAssignment.Station = tblPartStation.Station)" _
& " ORDER BY tblPartRouteAssignment.Route, tblPartInfo.Description;"
Then I reassign the ControlSource for 4 fields:
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtFullStorage.ControlSource = "TravDistLineFeed"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtLineStaging.ControlSource = "TravDistStaging"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtEmptyStorage.ControlSource = "TravDistDock"
Forms!frmBaseRouteAssignment![RouteEfficiencyDetail].Form!txtDockReturn.ControlSource = "StackHtLFDelivery"
When I first go into the form the subform fields are editable but after the click event where I change the records source they are not.
How do I approach updating the key fields? Any suggestions?
Joel