Hi, I have a data entry form with a save button - I am wanting to check that the text box has a value before submitting to table.
VBA Code:
Private Sub btn_save_Click()
Dim strSQL As String
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim ctl As Control
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("Tbl_users", dbOpenDynaset, dbAppendOnly)
'Add user to table
RS.AddNew
RS!UserName = txt_username
RS!FirstName = txt_firstname
RS!FirstName = txt_lastname
RS!Password = txt_genpassword
RS!AccessLvl = cbo_AccessLvl
RS!Facility = cbo_facility
RS!Email = txt_email
RS!IsActive = "Yes"
RS!CreatedBy = Environ("USERNAME")
RS!CreateDate = Now()
RS.Update
MsgBox "Record Successfully Added"
End Sub