What are you expecting it to do?
Ignoring the mistyped }, VBA knows nothing about [Field1], [Field2], etc.:
that's how you refer to fields in a table in a query.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
JimP said:
This is the code:
Function SelectCol(ColOpt as Integer)
SelectCol = Choose(ColOpt, [Field1}, [ Field2].......)
End Function
This is the same code that works in a query grid but returns an error in
a module - "External name not defined". I believe it has to do with the
brackets.
Douglas J. Steele said:
Choose is a VBA function, so yes, it will work in VBA.
Did you try? If so, did you have a problem with it? If so, what was the
problem?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
The "Choose" function in a query grid will allow you to select a field
name e.g.
Col1 = Choose (ColOpt, [Field1], [Field2].....)
Can this be done in a VBA function?