Solved Can not find object '|1' (1 Viewer)

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
Hello,
I'm trying to export a form to PDF and got an error message "Can bot find the object '|1'. What does that mean? The report I tried to export is get data from 10 tables, is because that? I used this code in another forms and it works but don't know why is not working in this form.
here is my code:
Code:
DoCmd.OutputTo acOutputReport, Me.OrderNumber & "-" & rptOrder", acFormatPDF, OutputFile

Thank you for your time
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:01
Joined
Oct 29, 2018
Messages
21,457
What is the value in OutputFile?
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
I tried debug, it shows the OrderNumber but for some reason it keeps give me this error message
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2013
Messages
16,610
this looks wrong

Me.OrderNumber & "-" & rptOrder"

suspect it should be

Me.OrderNumber & "- rptOrder"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:01
Joined
Feb 28, 2001
Messages
27,148
Invariably, the "cannot find '|1' in ..." means that in a query-dependent object (such as but not limited to a report), you have either spelled the name of a field wrong OR you have qualified a field with a table name and you spelled the table name wrong.

EDIT: CJ's comment makes sense too.
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
the name of the report is rptOrder not -rptOrder, I the report save as 1234567-rptOrder. It works if I remove the ordernumber but we need to have the ordernumber to identify the report. I did try Me.OrderNumber & "- rptOrder" and it has the same error message
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2013
Messages
16,610
in that case try

DoCmd.OutputTo acOutputReport,"rptOrder", acFormatPDF, "C:\" & Me.OrderNumber & "-rptOrder"

set the path to what you want.

Always helps to google the method/function/whatever so you know what each of the parameters mean

 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:01
Joined
Oct 29, 2018
Messages
21,457
I tried debug, it shows the OrderNumber but for some reason it keeps give me this error message
Hi. Just in case it matters, can you show us the actual value of OutputFile?
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
sorry, I was wrong. I took it back what I mention before. I just realized that the code was not working in another form either. Is any other way to save reports with modified report name?

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:01
Joined
Oct 29, 2018
Messages
21,457
sorry, I was wrong. I took it back what I mention before. I just realized that the code was not working in another form either. Is any other way to save reports with modified report name?

Thanks
Hi. This would be the third time I ask this question. Can you show us the value I requested twice before? Otherwise, maybe consider sharing a copy of your db.
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
Sorry, here is the screen shot
1607047362491.png
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 23:01
Joined
Jan 20, 2009
Messages
12,851
Messages like that can be due to having the name of an object such as a control or form the same as that of a module or the database itself.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:01
Joined
May 7, 2009
Messages
19,230
DoCmd.OutputTo acOutputReport, "rptOrder", acFormatPDF, Me.OrderNumber & "-rptOrder.pdf"
 

onur_can

Active member
Local time
Today, 06:01
Joined
Oct 4, 2015
Messages
180
I agree with The_Doc_Man. Gives this error due to inaccuracies in domain names.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2013
Messages
16,610
@urjudo - do reread the whole thread - a number of suggestions and questions have been asked which you are ignoring. You certainly don't appear to have tried the suggestions
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
@all , sorry , I wasn't trying to ignore any suggestions or questions, if I make you feel that way, please forgive me. I might have missed reading one or two replies but I would never ignore. I respect each of you for your knowledge and skills and appreciate your assistance. I sent the screen shot to show theDBGuy that the value outputfile if I didn't misunderstand what he is asking.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:01
Joined
Oct 29, 2018
Messages
21,457
I sent the screen shot to show theDBGuy that the value outputfile if I didn't misunderstand what he is asking.
In your original post, you showed us a piece of VBA code that has OutputFile as a variable. I was asking what value did you assign to it.

To show us that value, you could have either shown us the line:

OutputFile="c://folder/filename.pdf"

or the result of:

Debug.Print OutputFile

Instead, you decided to show us a screenshot of what looks like a macro, and you only showed us half of it, so we can't really tell what could be missing or wrong with that macro.
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
@theDBguy,
I did not assigned the location of the OutputFile because I don't know where the users want to save the reports to, that's why I leave open. But I think I show assign the location, correct?

@arnelgp,
I tried your method, it works the way I want , but one more question, is there a way to specify where to save the newly name file?

Thanks all
 

urjudo

Member
Local time
Today, 08:01
Joined
Oct 9, 2020
Messages
67
@all,
I think I got it works now.
I set a location as FilePath then use @arnelgp's method:

FilePath = Environ("userprofile")\OneDrive\Order-PDF Forms\"
DoCmd.OutputTo acOutputReport, "rptOrder", acFormatPDF, FilePath & Me.OrderNumber & "-rptOrder.pdf"
Report(s) saved to the specific folder now.

Thank you so much to all for your time to helped me! Very appreciated!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:01
Joined
Oct 29, 2018
Messages
21,457
@all,
I think I got it works now.
I set a location as FilePath then use @arnelgp's method:

FilePath = Environ("userprofile")\OneDrive\Order-PDF Forms\"
DoCmd.OutputTo acOutputReport, "rptOrder", acFormatPDF, FilePath & Me.OrderNumber & "-rptOrder.pdf"
Report(s) saved to the specific folder now.

Thank you so much to all for your time to helped me! Very appreciated!
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom