Access + Insert Into + confirmation dialog

J

Joseph Liu

I am using MS Access 2003 with a DoCmd.RunSQL "Insert into ..." statement.
The statement executes perfectly but everytime when a record is inserted into
an Access table, I was prompted to confirm the insertion. Please advise where
I can eliminate this annoying prompt.

Thanks a lot.

Joseph
 
J

John W. Vinson

I am using MS Access 2003 with a DoCmd.RunSQL "Insert into ..." statement.
The statement executes perfectly but everytime when a record is inserted into
an Access table, I was prompted to confirm the insertion. Please advise where
I can eliminate this annoying prompt.

Thanks a lot.

Joseph

Rather than using RunSQL, use the Execute method:

On Error GoTo Proc_Error
<set up your insertion>
CurrentDb.Execute "Insert Into....", dbFailOnError
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number " in insert function"
Resume Proc_Exit
End Sub

This will both avoid the warning message AND trap any query errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top