This is my first attempt at an INSERT SQL statement:
I have users input the days off they want start and end dates. Then an admin approves the days and adds a control number. I am trying to add the control number to the table but only if it matches the dates selected.
I am getting an error "Query input must contain at least one table or query. the table's name is Leave I don't understand what I'm missing
Code:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [Leave] ([Control Number])" _
& "values ('" & Me.txtControl.Value & "')" _
& "WHERE (((Leave.[Start Date] = me.txtStart.value) AND ((Leave.[End Date])= me.txtEnd.value))"
DoCmd.SetWarnings True
I have users input the days off they want start and end dates. Then an admin approves the days and adds a control number. I am trying to add the control number to the table but only if it matches the dates selected.
I am getting an error "Query input must contain at least one table or query. the table's name is Leave I don't understand what I'm missing