Solved

Access 2003 - SQL Sever 2005 Issue with IDENTITY field

Posted on 2006-11-16
1
297 Views
Last Modified: 2012-08-13
Hi All,

Below is the layout of one of my functions and I am just after connecting my FrontEnd Access database with back end SQl Sever Database and I get the following error when I try to run a particalar command on my main form.

Error: Run-time error '3622' - "You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Sever that has an IDENTITY column"

I check the main table it was pulling the informaton from tblCompany and the CompanyID does have IDENTITY as a datatype.

Here is my function - the error occurs when i set record to a recordset(query).

Has anyone got any ideas? Thanks again in advance for all the help.

Private Sub Form_Current()

    Dim query As String
    Dim Records As Object
    Dim Items As String

    query = "SELECT crpProducts.crpProduct_ID, crpProducts.crpProduct_Description, tblCompany.CompanyName, crpLicenseMethods.crpLicenseMethod_Description " & _
      "FROM tblCompany INNER JOIN crpProducts ON tblCompany.CompanyID = crpProducts.crpProduct_CompanyID, crpLicenseMethods " & _
      "WHERE crpProducts.crpProduct_AssociatedProductID=" & crpProduct_ID & " " & _
      "AND tblCompany.CompanyID = crpProducts.crpProduct_CompanyID " & _
      "AND crpLicenseMethods.crpLicenseMethod_ID = crpProducts.crpProduct_crpLicenseMethodID " & _
      "AND crpProducts.crpProduct_crpLicenseMethodID <> 1 " & _
      "ORDER BY tblCompany.CompanyName,crpProducts.crpProduct_Description;"
    Set Records = CurrentDb.OpenRecordset(query)

    txtProductList.Locked = False
    txtProductList.SetFocus
    If Records.RecordCount > 0 Then
        Records.MoveFirst
        Do
            If Not Items = "" Then Items = Items & Chr(13) & Chr(10) & Chr(10)
            Items = Items & Records("CompanyName") & Chr(13) & Chr(10) & _
            Space(5) & Records("crpProduct_Description") & Chr(13) & Chr(10) & _
            Space(5) & "(" & Records("crpLicenseMethod_Description") & ")"
            Records.MoveNext
        Loop Until Records.EOF
        txtProductList.Text = Items
    Else
        txtProductList.Text = "No other products are associated with this product."
    End If
    txtProductList.Locked = True

End Sub
0
Comment
Question by:sabrina_spillane
1 Comment
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 125 total points
ID: 17962363
It's asking you to open the recordset thusly

Set Records = CurrentDb.OpenRecordset(query, dbOpenDynaset, dbSeeChanges)
'----------------------------------------------------------^^^^^ might just need to be dbOpenSnapsot as you don't make edits
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

821 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