Solved

Access 2003 - SQL Sever 2005 Issue with IDENTITY field

Posted on 2006-11-16
1
271 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now