Help with this COde conversion

A

Anthony Acri

Need help with this code. When I open it up, it is looking for as Table.

It states it cannot find this user defined function I guess. I am trying to
convert from Acces-97 to Access-2000

After it assign PrintTB as Table, it uses this reference to point to the
table
("Borgo Temporary Address Label Table_BarCode")

Is there another object I can use to do this??
Any help is appreciated



Dim Db As Database, DetRecs As Recordset, HeadRecs As Recordset

Dim PrintTb As Table ????? Get error on this statement

Dim StrHSQL, StrDSQL As String
Dim ProdNumb$
ProdNumb$ = Me.[Production Order Number]

Set Db = CurrentDb()

Set PrintTb = Db.OpenTable("Borgo Temporary Address Label Table_BarCode")
........

' clear the table before refilling it

If PrintTb.EOF = False Then PrintTb.MoveFirst
Do Until PrintTb.EOF
PrintTb.Delete
PrintTb.MoveNext
Loop
 
P

Paul Overway

Your code goes back to Access v2.0. Table has not been around for a while.
You should revise code as follows:

Dim Db As Database, DetRecs As Recordset, HeadRecs As Recordset

Dim PrintTb As Recordset ????? Get error on this statement

Dim StrHSQL, StrDSQL As String
Dim ProdNumb$
ProdNumb$ = Me.[Production Order Number]

Set Db = CurrentDb()

Set PrintTb = Db.OpenRecordset("Borgo Temporary Address Label
Table_BarCode")
.......

' clear the table before refilling it

If PrintTb.EOF = False Then PrintTb.MoveFirst
Do Until PrintTb.EOF
PrintTb.Delete
PrintTb.MoveNext
Loop
 
D

Dirk Goldgar

Paul Overway said:
Your code goes back to Access v2.0. Table has not been around for a
while. You should revise code as follows:

Dim Db As Database, DetRecs As Recordset, HeadRecs As Recordset

Dim PrintTb As Recordset ????? Get error on this statement

Except that now he *won't* get an error on that statement. <g> However,
it's worth mentioning that he will need to set a reference (in the VB
Editor, click Tools -> References...) to the Microsoft DAO 3.6 Object
Library, and uncheck the default reference to Microsoft ActiveX Data
Objects 2.x Library.
 
P

Paul Overway

True....but since he didn't indicate getting an arror on the preceding
statements, it would appear he has already done that.
 
D

Dirk Goldgar

Paul Overway said:
True....but since he didn't indicate getting an arror on the preceding
statements, it would appear he has already done that.

You may be right.
 

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