Help with this COde conversion

  • Thread starter Thread starter Anthony Acri
  • Start date Start date
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
 
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
 
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.
 
True....but since he didn't indicate getting an arror on the preceding
statements, it would appear he has already done that.
 
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.
 
Back
Top