[Webinar] Streamline your web hosting managementRegister Today


How to avoid the Runtime Error '2714', There is already an object named 'tblBrMiss' in the database ?

Posted on 2007-10-12
Medium Priority
Last Modified: 2012-05-05
I am developing an Access application using an ADP file with Access as the front end and SQL Server as the back end database.

In the Access application I use VBA code. In the following IF statement, I perform 2 successive
SQL Statements. When the compiler executes the 2nd SQL statement:

I get a Runtime Error '2714'.
There is already an object named 'tblBrMiss' in the database ?
The first SQL statement is a SELECT INTO.
The second SQL statement is INSERT INTO    SELECT FROM.
If Me.Frame472.Value = 1 Then
      str_sql = "SELECT distinct Left(tblTSpringSpLNExp.[CPS Account Number],3) AS NameOfTheColumn INTO dbo.tblBrMiss from tblTSpringSpLNExp" & _
      " where Left(tblTSpringSpLNExp.[CPS Account Number],3) not in " & _
      "(SELECT branch from tblPSEmail) order by Left(tblTSpringSpLNExp.[CPS Account Number],3)"
      DoCmd.RunSQL (str_sql)

      str_slq = "INSERT INTO dbo.tblBrMiss SELECT distinct BRANCH from dbo.tblPSEmail where emailadd Is Null or costcenter is Null"
      DoCmd.RunSQL (str_sql)
End If
Question by:zimmer9
LVL 17

Accepted Solution

Chris Mangus earned 2000 total points
ID: 20067290
You have misnamed the variable that holds your SQL command for the second statement...

str_slq = "INSERT  

Should be

str_sql = "INSERT

Author Comment

ID: 20067330
Good catch.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question