Thanks Jim, but I need to check if a text box is actually present. What I have is 175 text boxes, one for each supply that can be ordered. I use code to loop through the text boxes and find which ones have a quantity in them. Here is that code:
For I = 1 To 175
If Me("txtSuppQty" & I).Enabled = True Then
If Me("txtSuppQty" & I) = "0" Then
Me("txtSuppQty" & I) = Null
End If
If Not IsNull(Me("txtSuppQty" & I)) Then
Set rs = db.OpenRecordset("SupplyRequestDetail", DB_OPEN_DYNASET)
rs.AddNew
rs("SupplyRequestID") = txtSupplyRequestID
rs("SupplyID") = Me("cboSuppID" & I)
rs("Quantity") = Me("txtSuppQty" & I)
rs.Update
rs.Close
End If
Else: Me("txtSuppQty" & I).Locked = False
Me("txtSuppQty" & I).Enabled = True
End If
Next I
As you can see I have assigned each of the text boxes names with ascending numbers in order to loop through them. The problem is if I remove one of the supplies and have to remove its corresponding text box then when I run the code it says is can't go on because txtSuppQty123 is missing. I need to add an if statment that says if txtSuppQty123 is not present skip it and go on to the next.
I hope this makes some snese.
Thanks for your help.