Microsoft Access cannot find the object 'I1' (1 Viewer)

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
Why not use intellisense? :(, that is what it is there for?
View attachment 97840
I followed the intelesence as a guide, still can not get the report to export and using file save as with the report name and content of the form auto populated
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:11
Joined
Sep 21, 2011
Messages
14,231
You already know what you want to save it as?
The best you can do is ask the user where, if you are not going to hard code a folder to save it to?
 

June7

AWF VIP
Local time
Yesterday, 17:11
Joined
Mar 9, 2014
Messages
5,465
Simple example code:
Code:
Dim sFolder As String
Dim fd As FileDialog
Dim booResult As Boolean
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.AllowMultiSelect = False
fd.title = "Select folder"
While booResult = False
    If fd.Show = True Then
        'folder path was selected
        booResult = True
        sFolder = fd.SelectedItems(1)
        DoCmd.OutputTo acReport, "DAW Sheet - Comm Approve", acFormatPDF, _
                       sFolder & "\DAW Sheet - Comm Approve - Registration - " & Forms![CS Raised - Mail]![RegCBO] & ".pdf"
    End If
Wend
 

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
You already know what you want to save it as?
The best you can do is ask the user where, if you are not going to hard code a folder to save it to?
Yes, I know what I want to call the file

The pop up save as window needs to pop up with the file name populated

"BPS-03" is from a control in the form

1643290794833.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:11
Joined
Sep 21, 2011
Messages
14,231
Yes, I know what I want to call the file

The pop up save as window needs to pop up with the file name populated
That then give the user the chance to change it to something else?, so why bother naming in the first place?
 

June7

AWF VIP
Local time
Yesterday, 17:11
Joined
Mar 9, 2014
Messages
5,465
Yes, I know what I want to call the file

The pop up save as window needs to pop up with the file name populated

"BPS-03" is from a control in the form

View attachment 97841
I already advised in post 17 it won't work like that. See sample code in post 23.
 

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
That then give the user the chance to change it to something else?, so why bother naming in the first place?
Yes, this seems to be more complicated than i thought it would be
I default back to below code until I managed to get it working with file save as and controls from the form

DoCmd.OutputTo acReport, ("DAW Sheet - Comm Approve"), acFormatPDF
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:11
Joined
Sep 21, 2011
Messages
14,231
Well
Yes, this seems to be more complicated than i thought it would be
I default back to below code until I managed to get it working with file save as and controls from the form
Well at least name it as you want and put in a folder that suits everyone, and just issue a message "Report saved as " & "DAW Sheet - Comm Approve" & " in folder " & strFolder

If you are going to have report names like that, I'd also use a variable for the report name strReport ?
That way if you ever change it, you change it on one place only?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:11
Joined
Oct 29, 2018
Messages
21,453
Yes, this seems to be more complicated than i thought it would be
I default back to below code until I managed to get it working with file save as and controls from the form
If all I want for the user to do is decide where to save a file, I would use a folder picker instead. If you can post a sample db, we can help you with that.
 

Users who are viewing this thread

Top Bottom