Solved

Access VBA SQL error

Posted on 2011-09-15
7
346 Views
Last Modified: 2012-05-12
Using this code but get an error (See below)
Sql = "SELECT tbl_Inventory.InternalKeyNumber "
Sql = Sql & "FROM tbl_Inventory "
Sql = Sql & "WHERE tbl_Inventory.InternalKeyNumber = " & Ser

Set rst = Dbs.OpenRecordset(Sql)
    If rst.RecordCount = 0 Then
    MsgBox "Invalid Serial Number. Please try again"
    Exit Sub
    End If

ERROR:
 "You mus use dbseechanges with openrecordset when accessing SQL server table that has an identity column"
0
Comment
Question by:HKFuey
  • 4
  • 3
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36542153
Use this instead:

Set rst = db.OpenRecordset(sQL,dbOpenDynaset, dbSeeChanges)
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36542155
Sorry...

Set rst = dbs.OpenRecordset(sQL,dbOpenDynaset, dbSeeChanges)
0
 

Author Comment

by:HKFuey
ID: 36542163
Hi mbizup

I get "Object Required error"
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:HKFuey
ID: 36542166
I got it thanks
needs to be Dbs!!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36542169
Do you have DBS defined anywhere?

Dim dbs as Database
Set dbs = CurrentDB
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36542172
:-)
0
 

Author Closing Comment

by:HKFuey
ID: 36542174
Superb! thanks!!!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

895 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

14 Experts available now in Live!

Get 1:1 Help Now