Welcome to the forum........
Is there a question??
I notice you are missing an apostrophe in the VALUES line. You have
Code:
VALUES(" & Me.bxnbarcode
should be
Code:
VALUES('" & Me.bxnbarcode
I don't like to create my SQL string like that. I use a separate variable; then I can use the command "Debug.Print" to see if the SQL string is formatted correctly.
Code:
Private Sub bxnAdd_Click()
'add data to table
'refresh data in list on form
Dim sSQL As String
sSQL = "INSERT INTO tblMovies(MovieBarcode, Title, Category, Hiretype, VideoType)"
sSQL = sSQL & " VALUES( '" & Me.bxnbarcode & "', '" & Me.bxnname & "', '" & Me.bxncategory
sSQL = sSQL & "', '" & Me.bxnhiretype & "', '" & Me.bxnvideotype & "');"
' Debug.Print sSQL
CurrentDb.Execute sSQL, dbfailonerror
End Sub
Results of the debug statement
Code:
Code:
INSERT INTO tblMovies(MovieBarcode, Title, Category, Hiretype, VideoType) VALUES( 'GH123456', 'The Programmer', 'Drama', 'Overnight', 'DVD');
BTW, in this statement "DoCmd.Close acForm, "frmAddMovie", acSaveYes, the argument "acSaveYes" does not save the data, it is for form design changes.
All you need is
DoCmd.Close acForm, "frmAddMovie"
or
DoCmd.Close acForm, Me.Name (closes the active form)