Creating an Index

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
 
D

Douglas J. Steele

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])"
 

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