split function

D

DaveE

I'm trying to use the split function in my vba code. The database has a
field named split in a table. The function errors. I renamed the field and
tried again. Same error. I deleted the field. The error now says it can't
find the field split. How can I get rid of this field so I can use the split
function?
 
J

Jack Leach

How about some code samples or error numbers or descriptions... it sounds
like you have code that's looking for a field named Split, though without
further information it's going to be tough to provide any help.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

DaveE

Code snippet:

Me.PatientName.SetFocus
strPatientName = Me.PatientName.Text
vInitialsTemp = SPLIT(strPatientName, " ")

Err.Number = 2465
Err.Description = Master Case Log can't find the field 'SPLIT' referred to
in your expression.
 
J

Jack Leach

hmmm...

Is your Track Name Autocorrect option turned off? Make sure that's off and
do a compact and repair. It seems likely that between the autocorrect and
any leftovers from an unrepaired/compacted database, and the assumed variant
datatype vInitialsTemp that Access may see the leftover field Split and be
trying to assign a field object type to the variant.

Check the Autocorrect, change the datatype to a string rather than variant,
disambiguate the Split function (strInitialsTemp = VBA.Split(strPatientName,
" ")), compile all modules, compact and repair, and then try again. If it
doesn't work you may want to import everything into a new database, but I
don't think this will be required.

The string variable strInitialsTemp will have to be declared as an array to
avoid a type mismatch:
Dim strInitialsTemp() As String

(the variant datatype, not declared as an array should work with the
function, but a variant decalred as an array produces a type mismatch error.
The reverse applies for strings, but you should avoid variants without a
specific need)

The Track Name Autocorrect feature is recommended to be always turned off,
for various performance reasons and some bugs that it may introduce. In 2003
it can be found under the Access menu at Tools -> Options -> General Tab,
lower right corner. Not sure about other versions.


hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
J

John W. Vinson

I'm trying to use the split function in my vba code. The database has a
field named split in a table. The function errors. I renamed the field and
tried again. Same error. I deleted the field. The error now says it can't
find the field split. How can I get rid of this field so I can use the split
function?

Check to see if you have Name Autocorrupt... oops, Name Autocorrect... checked
in Tools... Options... General. If so, uncheck "Track Name Autocorrect
Information", and then run Tools... Database Utilities... Compact and Repair
and try again.
 
D

DaveE

Thanks for the help, guys. I had to remove references to the Split field a
couple of other spots. I disabled Track Name Autocorrect and everything
seems to be working now. Thanks again.
 

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