Moved to SQL, now code fails

S

Steve Mahon

I've upsized the tables successfully to SQL 2000. Now I'm getting errors
3219 and 3251. I am inexperienced with programming, but think I have figured
out that the operations the code is doing are different for odbc versus
imbedded table (jet?) I'll paste one of the functions at the end of this
message, and would really appreciate suggestions for revising the code or
links to related articles. Thanks, Steve

Function GetTableInformation(ParmTable, parmID, parmOption)

Dim db As Database, tblGeneric As Table
Set db = CurrentDb()

Select Case ParmTable
Case "Component"
Set tblGeneric = db.OpenTable("Component")
tblGeneric.Index = "PrimaryKey"
tblGeneric.Seek "=", parmID

If (tblGeneric.NoMatch = False) Then
Select Case parmOption
Case "Description"
GetTableInformation = tblGeneric("Description")
Case "Category"
GetTableInformation = tblGeneric("Category")
Case "Group"
GetTableInformation = tblGeneric("Group")
End Select
End If

Case "Product"
Set tblGeneric = db.OpenTable("Product")
tblGeneric.Index = "PrimaryKey"
tblGeneric.Seek "=", parmID

If (tblGeneric.NoMatch = False) Then
Select Case parmOption
Case "Description"
GetTableInformation = tblGeneric("Description")
Case "Default Lock"
GetTableInformation = tblGeneric("Default Lock")
Case Else
MsgBox "Error in (GetTableInformation)"
End Select
End If

End Select

End Function
 
D

Dan Artuso

Hi,
I assume your tables are now linked and if you look in Help, you will
see that you can't use the Seek method with linked tables.

You may be able to use the FindFirst method (of a recordset object)
instead. Help will explain the FindFirst syntax.
 
B

Brendan Reynolds

In addition to Dan's point about Seek, in DAO 3.x, the Database object does
not have an OpenTable method. I believe Access 97 with the DAO 2.x/3.x
Compatibility Library is the last version of Access that will support this
old DAO 2.x syntax. (There is no DAO 2.x/3.6 Compatibility Library for
Access 2000 and later).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top