Error 2465 (1 Viewer)

5hadow

Member
Local time
Yesterday, 21:44
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?
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:44
Joined
Sep 21, 2011
Messages
14,238
What is the error? Some of us do not know all the error numbers off by heart? :(
 

5hadow

Member
Local time
Yesterday, 21:44
Joined
Apr 26, 2021
Messages
89
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:44
Joined
Sep 21, 2011
Messages
14,238
Show the values of
Me.fldFolder
WordDocs.name
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:44
Joined
Feb 19, 2002
Messages
43,233
If the name field contains special characters or embedded spaces, you will need to enclose it in double quotes.
 

5hadow

Member
Local time
Yesterday, 21:44
Joined
Apr 26, 2021
Messages
89
Me.fldFolder =
\Document Reviews\Document Reviews\2022\DR-22-007
WordDocs.name =
CC177-T3-429-4.05-03.docx
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 20:44
Joined
Feb 28, 2001
Messages
27,147
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.
 

5hadow

Member
Local time
Yesterday, 21:44
Joined
Apr 26, 2021
Messages
89
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?
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:44
Joined
Sep 21, 2011
Messages
14,238
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:44
Joined
Sep 21, 2011
Messages
14,238
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?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 02:44
Joined
Sep 12, 2006
Messages
15,641
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:

Gasman

Enthusiastic Amateur
Local time
Today, 02:44
Joined
Sep 21, 2011
Messages
14,238
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?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 02:44
Joined
Sep 12, 2006
Messages
15,641
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

Top Bottom