G
Grizz
In my partial code below I am updateting two tables at the same time, What is
the code to pass the new Autonumber from the one table rec2 to the other
table rec? This is how my relationship is setup
Also notice the Truck ID in rec statement, This is from a combobox, How can
I get just the ID sent not the actual number? I have tried
Me!CmbTruckNumber.ID or TruckID as the field is called, I have a code in
place for the combobox to update new Truck number if not listed.
Set rec = dbLocal.OpenRecordset("LoadInfoTbl", dbOpenDynaset)
Set rec2 = dbLocal.OpenRecordset("EquationTbl", dbOpenDynaset)
With rec2
.AddNew
!Exspense = Me!TxtExspense
!PlantDiscount = Me!TxtPlantDiscount
!PurchasePrice = Me!TxtBoughtPrice
!HotPrice = Me!TxtHotPrice
!HaulCost = Me!TxtHaulCost
!Yield = Me!TxtYield
.Update
End With
With rec
.AddNew
!BuyDate = Me!TxtDate
!Weight = Me!TxtWeight
!Mileage = Me!TxtMileage
!Rate = Me!TxtRate
!BuyPrice = Me!TxtBuyPrice
!TruckID = Me!CmbTruckNumber
.Update
End With
Thank You
the code to pass the new Autonumber from the one table rec2 to the other
table rec? This is how my relationship is setup
Also notice the Truck ID in rec statement, This is from a combobox, How can
I get just the ID sent not the actual number? I have tried
Me!CmbTruckNumber.ID or TruckID as the field is called, I have a code in
place for the combobox to update new Truck number if not listed.
Set rec = dbLocal.OpenRecordset("LoadInfoTbl", dbOpenDynaset)
Set rec2 = dbLocal.OpenRecordset("EquationTbl", dbOpenDynaset)
With rec2
.AddNew
!Exspense = Me!TxtExspense
!PlantDiscount = Me!TxtPlantDiscount
!PurchasePrice = Me!TxtBoughtPrice
!HotPrice = Me!TxtHotPrice
!HaulCost = Me!TxtHaulCost
!Yield = Me!TxtYield
.Update
End With
With rec
.AddNew
!BuyDate = Me!TxtDate
!Weight = Me!TxtWeight
!Mileage = Me!TxtMileage
!Rate = Me!TxtRate
!BuyPrice = Me!TxtBuyPrice
!TruckID = Me!CmbTruckNumber
.Update
End With
Thank You