Hi All,
its been along time since I visited this forum. I need some assistance please.
I have a form that inputs data into a worksheet and it also allows me to change the data in any record (line of data) l select. This is done using a combo box on the form selecting a unique number that I have given each record. The column where the unique number is stored comes from another worksheet in the same workbook which is a obtained by a formula.
When I use the combo box to select the specific unique number I require they all show up and I can select the unique number that I want and all data associated with that number is visible and can be changed.
When I press the submit button on the form I get the Run-time error '91' : object variable or with block not set
If I was to manually type the unique number into the column where they are stored and use the form it works perfectly. So I believe the code is not recognizing the value that the formula is inputting as a valid piece of data. I think!
thank you.
Here is the code. I hope I am doing this correctly.
Private Sub cmdSubmitData_click()
Dim Fnd As Range
If MsgBox("Are you sure you want to update the records?", vbYesNo + vbQuestion, "update Record") = vbYes Then
Set Fnd = Range("B:B").Find(Me.cmbTruckDockets.Value, , , xlWhole, , , False, , False)
Cells(Fnd.Row, 12) = txtNetWeight.Value
Cells(Fnd.Row, 13) = txtRate.Value
Cells(Fnd.Row, 17) = txtHarvestPay.Value
Cells(Fnd.Row, 18) = txtHarvestPayDate.Value
Cells(Fnd.Row, 19) = txt2ndPayment.Value
Cells(Fnd.Row, 20) = txt2ndPayDate.Value
Cells(Fnd.Row, 25) = txtLoyaltyLarge.Value
Cells(Fnd.Row, 26) = txtLoyaltyMedium.Value
Cells(Fnd.Row, 27) = txtLoyaltyFreight.Value
Cells(Fnd.Row, 32) = txtKCT1stGradePay.Value
Cells(Fnd.Row, 33) = txtKCT2ndGradePay.Value
Cells(Fnd.Row, 34) = txt1stGradePay.Value
Cells(Fnd.Row, 35) = txt2ndGradePay.Value
Cells(Fnd.Row, 36) = txt3rdGradePay1.Value
Cells(Fnd.Row, 37) = txtFactoryPay.Value
Cells(Fnd.Row, 50) = txtKCT1stGradeWeight.Value
Cells(Fnd.Row, 51) = txtKCT2ndGradeWeight.Value
Cells(Fnd.Row, 52) = txt1stGradeWeight.Value
Cells(Fnd.Row, 53) = txt2ndGradeWeight.Value
Cells(Fnd.Row, 54) = txt3rdGradeWeight.Value
Cells(Fnd.Row, 55) = txtFactoryWeight.Value
Cells(Fnd.Row, 56) = txtLoyaltyCartonLarge.Value
Cells(Fnd.Row, 57) = txtLoyaltyCartonMedium.Value
Cells(Fnd.Row, 65) = txtRemarks.Value
Cells(Fnd.Row, 73) = Blemish.Value
Cells(Fnd.Row, 74) = Albedo.Value
Cells(Fnd.Row, 75) = Small_Sizes.Value
Cells(Fnd.Row, 76) = Necking.Value
Cells(Fnd.Row, 77) = Some_Green.Value
Cells(Fnd.Row, 78) = Coarse.Value
Cells(Fnd.Row, 79) = Large_Sizes.Value
Cells(Fnd.Row, 80) = Sunburn.Value
Cells(Fnd.Row, 81) = Splits.Value
Cells(Fnd.Row, 82) = Heavy_Blemish.Value
Cells(Fnd.Row, 83) = Scales.Value
Cells(Fnd.Row, 84) = Dry.Value
Cells(Fnd.Row, 85) = Puffy.Value
Cells(Fnd.Row, 86) = Katydid.Value
Cells(Fnd.Row, 87) = Oval_Shaped.Value
End If
End Sub
Bookmarks