I am trying to copy a table, appending the date to the destination table name in VB code.
However I get a Type Mismatch error.
Here's the troublesome code:
Dim MyDay, MyMonth, MyYear, MyDate, MyNewTable As String
MyDay = Format(Date, "dd")
MyMonth = Format(Date, "mm")
MyYear = Format(Date, "yyyy")
MyDate = "_" & MyDay & "_" & MyMonth & "_" & MyYear
MyNewTable = "OldConsignmentNumbers" & MyDate
DoCmd.CopyObject MyNewTable, acTable, "Consignment Numbers"
in Microsoft Office Access 2003 (11.6566.6568) SP2.
Can anyone help?
Thanks.
However I get a Type Mismatch error.
Here's the troublesome code:
Dim MyDay, MyMonth, MyYear, MyDate, MyNewTable As String
MyDay = Format(Date, "dd")
MyMonth = Format(Date, "mm")
MyYear = Format(Date, "yyyy")
MyDate = "_" & MyDay & "_" & MyMonth & "_" & MyYear
MyNewTable = "OldConsignmentNumbers" & MyDate
DoCmd.CopyObject MyNewTable, acTable, "Consignment Numbers"
in Microsoft Office Access 2003 (11.6566.6568) SP2.
Can anyone help?
Thanks.