Creating an Index

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

I am importing a spreadsheet and I need to make one of the fields indexed for
later lookup. Here is my programming to run the process which ends with me
having a new table called "tblMatchingBudgetRpt". My CREATE INDEX statement
causes an error.
Can you help?

Private Sub cmdBudMatchNet_Click()
Dim stDocName As String

stDocName = "mcrOutputMatchingTotals"
DoCmd.RunMacro stDocName

CurrentDb.Execute "CREATE INDEX BudgetVendor ON tblMatchingBudgetRpt
(Budget Vendor)"

End Sub
 
You've got a space between Budget and Vendor. If your field name includes a
space (and you can't rename it), use square brackets:

CurrentDb.Execute "CREATE INDEX BudgetVendor ON tblMatchingBudgetRpt
([Budget Vendor])"
 
Back
Top