Cannot insert a variable using INSERT in MS ACCESS.
the insert works great when I insert a hard-coded value such as
dbs.Execute "INSERT INTO Flights " _
& "(FlightID) VALUES " _
& "('2');"
But fails with a variable
Private Sub MainSaveBtn_Click()
Dim dbs As Database
Set dbs = CurrentDb
Dim id As Integer
id = 20
Debug.Print id
dbs.Execute "INSERT INTO Flights " _
& "(FlightID) VALUES " _
& "('id');"
dbs.Close
End Sub
*Flights table has only one Integer colum named FlightID
What am i missing here?
FlightandIDfields in a table or variables in your code?