Hey guys, I don't know how to bypass an error in my code. The code looks like this:
I'm filling in a table using data from the form. The Price from Text24 is automatically filled by a column in combo12. However the problem right now is that my price column is blank in my combo12 (because there is no value in the table that the combo box gets its info from). When I try this code, I get an error because of that. Is there anyway to just have it fill it with nothing when the price value in the original table is blank?Code:Private Sub Command29_Click() Dim rstTakeOut As DAO.Recordset Set rstTakeOut = CurrentDb.OpenRecordset("TakeOut", dbOpenDynaset) With rstTakeOut .AddNew .Fields("Date").Value = Text14.Value .Fields("WorkName").Value = Combo6.Column(1) .Fields("ProductName").Value = Combo9.Column(1) .Fields("ProductModel").Value = Combo12.Column(0) .Fields("Quantity").Value = Text59.Value .Fields("Price").Value = Text24.Value .Fields("Unit").Value = Combo12.Column(2) .Fields("ProductID").Value = Combo12.Column(3) .Fields("JobNumber").Value = Combo57.Column(1) .Update End With Me.Text59.Value = "" Me.Combo57.Value = "" Me.Combo6.Value = "" Me.Combo9.Value = "" Me.Combo12.Value = ""
Also a similar question. I have a calculation to subtract two DSum() functions in my VBA code. When one of the DSum() functions return nothing, instead of taking it as a 0, it just straight up doesn't give me an answer. Can I with it be 0 when there is no data found using the criteria for the DSum?