So I have a form with an unbound textbox named (ProjectNumber) and a button (AddProjectNumberButton). When I click the button I want the text from the textbox added as a new record to the (Projects) table under the (Project_Number) field.
I tried the code below but it didn't work. It screwed up on the "Dim RS As DAO.Recordset" line. Any help would greatly be appreciated.
Code:
Private Sub AddProjectNumberButton_Click()
Dim RS As DAO.Recordset
Set RS = CurrentDb.openrecordset(Projects, dbopendynaset)
RS.AddNew
RS("Project_Number") = Me![ProjectNumber]
RS.Update
RS.Close
Set RS = Nothing
End Sub