Error 2465

5hadow

Member
Local time
Today, 04:39
Joined
Apr 26, 2021
Messages
89
I get the run time error 2465 with this code:
docxFile = Me.fldFolder & "\" & Left([WordDocs.Name], 25)


WordDocs.Name is a filename with .docx extension
I'm guessing i've got syntax wrong? Anyone know how to fix it?
 
What is the error? Some of us do not know all the error numbers off by heart? :(
 
What is the error? Some of us do not know all the error numbers off by heart? :(
Oh, I'm sorry,

1644603721659.png


Can't find the field '|1' referred to in your expression.
 
Show the values of
Me.fldFolder
WordDocs.name
 
If the name field contains special characters or embedded spaces, you will need to enclose it in double quotes.
 
Me.fldFolder =
\Document Reviews\Document Reviews\2022\DR-22-007
WordDocs.name =
CC177-T3-429-4.05-03.docx
 
OK, that error reporting style is associated with subroutine calls and queries, which you didn't show us. The instruction line you showed us doesn't invoke a function likely to trigger that error. There is no "error" signaled by the LEFT function if the contents of [WordDocs.Name] is shorter than 25 characters. It just provides what you have up to the leftmost 25 characters. But it CAN and DOES return fewer characters if you provide fewer characters. Not 100% sure but it will probably ONLY barf if somehow you fed it a NULL field and I absolutely would rule out that you did that because the error in that case would NOT be the one you reported..

I generally associate that error-reporting syntax, specifically the "|1" part, with an error in the first field named in a query. But you showed us no query. I don't offhand know anything about QMO portal so anything else I offer would be guessing. I tried to look it up online but the answers were ambiguous because I don't know the correct product name.
 
Ok, this is weird. I was playing around with the code, rewrote it again just as above and now it works :unsure:

Anyone know why?
 
Works for me?
Code:
fldFolder = "\Document Reviews\Document Reviews\2022\DR-22-007"
WordDocsname = "CC177-T3-429-4.05-03.docx"
tt= fldfolder & "\" & left(worddocsname,25)
? tt
\Document Reviews\Document Reviews\2022\DR-22-007\CC177-T3-429-4.05-03.docx
 
Ok, this is weird. I was playing around with the code, rewrote it again just as above and now it works :unsure:

Anyone know why?
Well computers do not change their minds so something at your end changed?
 
I would be concerned about the possible implications of assuming that the left function is always bound to work.

left(worddocsname,25)

I would add code to check the length, and report it in some cases. There must be some reason to select the first 25 chars, as otherwise you could just use the entire file name without testing it at all. Maybe there's some illegal character in the file name.

In passing, I struggle to see how that error 2465 could refer to the line of code you mention either.
Maybe the file referred to by the assignment of docxfile doesn't exist. Maybe it's even just open and can't be used.
 
Last edited:
I changed WordDocsname = "CC177"
tt= fldfolder & "\" & left(worddocsname,25) still worked OK.
I was even surprised that Left(whatever,0) even works? It does not complain of an error, of course does not produce anything?
 
I changed WordDocsname = "CC177"
tt= fldfolder & "\" & left(worddocsname,25) still worked OK.
I was even surprised that Left(whatever,0) even works? It does not complain of an error, of course does not produce anything?

A good point. I meant more that the assignment left(variable,25) might not return an appropriate value, rather than that it would not work at all.
 

Users who are viewing this thread

Back
Top Bottom