New answers tagged microsoft-access
You can test the name for each control and do what you want instead Private Sub Command2061_Click() 'Clear Const cstrPrompt As String = _ "Are you sure you want to Clear this Form? Yes/No" If MsgBox(cstrPrompt, vbQuestion + vbYesNo) = vbYes Then Dim Ctl As Control On Error Resume Next For Each Ctl In Me.Controls If ...
As stated in the comments, the best method is to set the ID field to be an AutoNumber. If you already have a bunch of data in that field, you will need to reset the field. Once that's done, simply don't include the field in your append query. Access will automatically fill in whatever the next value is for each new record.
Top 50 recent answers are included