Microsoft KB Archive/202018

= MOD2000: Jet ANSI 92 Objects Cannot Be Checked into Visual SourceSafe =

Article ID: 202018

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Office 2000 Developer Edition
 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q202018



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
When you try to check a Jet database that has queries or stored procedures created through the native OLEDB provider for Microsoft Jet into Microsoft Visual SourceSafe, the objects are not visible in the SourceSafe dialog box and cannot be checked in.



CAUSE
ANSI 92 objects, which are new in Access 2000, are not recognized by Visual SourceSafe.



RESOLUTION
If you plan to check your Access database objects into Visual SourceSafe, avoid creating stored procedures or queries through OLEDB. Instead, use standard Access queries or pass-through queries.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce Behavior
These steps first use Visual Basic for Applications to create a Jet stored procedure named qryCustomers that lists three fields from the Customers table in Northwind. Then, the steps will try to check the procedure into Visual SourceSafe.

 On a computer that has Visual SourceSafe installed, open the sample database Northwind.mdb.  Create a new module, and then type or paste the following functions:NOTE: The sample code in this article uses Microsoft ActiveX Data Objects. For this code to run properly, you must reference the Microsoft ActiveX Data Objects 2.x Library (where 2.x is 2.1 or later.) To do so, click References on the Tools menu in the Visual Basic Editor, and make sure that the Microsoft ActiveX Data Objects 2.x Library check box is selected.

Option Compare Database Option Explicit

Function CreateProc(sqlString) CurrentProject.Connection.Execute sqlString End Function

Function RunStoredProc(StoredProcName As String) Dim cmd As ADODB.Command Dim rst As ADODB.Recordset Set cmd = New ADODB.Command Set cmd.ActiveConnection = CurrentProject.Connection cmd.CommandText = StoredProcName cmd.CommandType = adCmdTable cmd.Execute Set rst = New ADODB.Recordset

rst.Open cmd

Do Until rst.EOF Debug.Print rst(0), rst(1), rst(2) rst.MoveNext Loop End Function   To create the stored procedure, in the Immediate window, type the following line, and then press ENTER: CreateProc("Create Procedure qryCustomers as SELECT * FROM Customers")   Type the following line in the Immediate window, and then press ENTER to run the stored procedure: RunStoredProc("qryCustomers")  Close the Visual Basic Editor.</li> On the Tools menu, point to SourceSafe, and then click Add Database to SourceSafe.</li> When you are prompted to close the database, click Yes.</li> Log into Visual SourceSafe, and then in the Add to SourceSafe Project dialog box, click OK.</li> You are prompted to create a new project for Northwind. Click Yes.</li> Note that the Add Objects to SourceSafe dialog box appears. Note that in the list named Objects to Be Added, you do not see qryCustomers, and you cannot add the stored procedure to the Visual SourceSafe project.</li></ol>

<div class="references_section">