?
Solved

Access VBA SQL error

Posted on 2011-09-15
7
Medium Priority
?
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 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