I have this line of code, that is supposed to prevent the user from inputting a record if the textbox in question is empty.
Private Sub Command17_Click()
If Me.Text13.Value = "" Then
Me.Text26.Value = "ENTER A BUY PRICE!"
Else
Dim sc1 As DAO.Recordset
Set sc1 = CurrentDb.OpenRecordset("Flips", dbOpenDynaset)
sc1.AddNew
sc1.Fields("ItemID").Value = Me.Combo0.Column(0)
sc1.Fields("BuyPrice").Value = Me.Text13.Value
sc1.Fields("Note").Value = Me.Text18.Value
sc1.Fields("Status").Value = "BOUGHT"
sc1.Update
Me.Flips.Requery
End If
End Sub
For whatever reason it does not work, neither the “ENTER A BUT PRICE!” bit or the bit that prevents the record from being input!
Can anyone help?
Thanks in advance,
Bob P
Thanks guys but I have just found a way round it, I set the default value of the textbox to 0 and then told the code: