J
John Halloran
When attempting to convert a database to 2003 I get a
message unable to compile. When I then try to print a
label using a macro mcrPrintLabel it states unable to
find function.
The Arboretum Foundation has used the macro which opens a
query to create a table called TempTable and then calls
for VBA with the line "RunCode" calling for function
Print_Label(). The function is as follows:
Function Print_Label()
' This sets up using the tblTempTable with a primary
key.
Dim MYDB As Database, tblMasterTable As Table,
tblLabelTable As Table
Set MYDB = CurrentDb()
Set tblMasterTable = MYDB.OpenTable("tblTemp")
Set tblLabelTable = MYDB.OpenTable("tblLabel")
tblMasterTable.Index = PRIMARYKEY
' Goto the first record of the table.
tblMasterTable.MoveFirst
' Read the record.
Do Until tblMasterTable.EOF
tblMasterTable.Edit
X = tblMasterTable("NumberOfLabels")
' Copy the record a certain number of times
For J = 1 To X
tblLabelTable.AddNew
tblLabelTable("Vendor") = tblMasterTable
("Vendor")
tblLabelTable("Department") =
tblMasterTable("Department")
tblLabelTable("Classification") =
tblMasterTable("Classification")
tblLabelTable("Name") = tblMasterTable
("Name")
tblLabelTable("BloomTime") =
tblMasterTable("BloomTime")
tblLabelTable("Tallness") = tblMasterTable
("Tallness")
tblLabelTable("Color") = tblMasterTable
("Color")
tblLabelTable("SellPrice") =
tblMasterTable("SellPrice")
tblLabelTable("BulbsInBag") =
tblMasterTable("BulbsInBag")
tblLabelTable.Update
Next J
' Go back to the first table and get the next record.
tblMasterTable.MoveNext
Loop
' Print the report for the temp table.
DoCmd.OpenReport "rptLabels3Across", A_PREVIEW
' Delete the temp table.
tblMasterTable.Close
tblLabelTable.MoveFirst
' Delete each record in a loop
Do Until tblLabelTable.EOF
tblLabelTable.Delete
tblLabelTable.MoveNext
Loop
' Close the tblLabel Table
tblLabelTable.Close
End Function
Any help would be appreciated.
message unable to compile. When I then try to print a
label using a macro mcrPrintLabel it states unable to
find function.
The Arboretum Foundation has used the macro which opens a
query to create a table called TempTable and then calls
for VBA with the line "RunCode" calling for function
Print_Label(). The function is as follows:
Function Print_Label()
' This sets up using the tblTempTable with a primary
key.
Dim MYDB As Database, tblMasterTable As Table,
tblLabelTable As Table
Set MYDB = CurrentDb()
Set tblMasterTable = MYDB.OpenTable("tblTemp")
Set tblLabelTable = MYDB.OpenTable("tblLabel")
tblMasterTable.Index = PRIMARYKEY
' Goto the first record of the table.
tblMasterTable.MoveFirst
' Read the record.
Do Until tblMasterTable.EOF
tblMasterTable.Edit
X = tblMasterTable("NumberOfLabels")
' Copy the record a certain number of times
For J = 1 To X
tblLabelTable.AddNew
tblLabelTable("Vendor") = tblMasterTable
("Vendor")
tblLabelTable("Department") =
tblMasterTable("Department")
tblLabelTable("Classification") =
tblMasterTable("Classification")
tblLabelTable("Name") = tblMasterTable
("Name")
tblLabelTable("BloomTime") =
tblMasterTable("BloomTime")
tblLabelTable("Tallness") = tblMasterTable
("Tallness")
tblLabelTable("Color") = tblMasterTable
("Color")
tblLabelTable("SellPrice") =
tblMasterTable("SellPrice")
tblLabelTable("BulbsInBag") =
tblMasterTable("BulbsInBag")
tblLabelTable.Update
Next J
' Go back to the first table and get the next record.
tblMasterTable.MoveNext
Loop
' Print the report for the temp table.
DoCmd.OpenReport "rptLabels3Across", A_PREVIEW
' Delete the temp table.
tblMasterTable.Close
tblLabelTable.MoveFirst
' Delete each record in a loop
Do Until tblLabelTable.EOF
tblLabelTable.Delete
tblLabelTable.MoveNext
Loop
' Close the tblLabel Table
tblLabelTable.Close
End Function
Any help would be appreciated.