|
-
Feb 6th, 2006, 02:56 AM
#1
Thread Starter
Junior Member
-
Feb 6th, 2006, 03:26 AM
#2
Re: Where is common dialog?
You probably manually added the cdl to your toolbox. So that means you need to do the same for the copy on your other system. When you manually add references and controols you need to also include them with the database where ever your deploy it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 6th, 2006, 04:41 AM
#3
Thread Starter
Junior Member
Re: Where is common dialog?
Thanks for that info. Just one problem... On the laptop, the ActiveX controls list doesn't include the common dialog control, even though it's an identical Office install. When I used it on my desktop PC, it was already in the list and ready to use. How do I find the control so I can copy it across with the database and can it be somehow embedded?
(I do not have the ability to 'pack and go' my database in runtime format and have to have Access installed on whichever PC is going to run it at the moment)
Last edited by OllieVB; Feb 6th, 2006 at 05:00 AM.
Ollie
Mess with the bull... You get the horns!
... Windows XP Home SP2
... Visual Basic 6 Professional Edition
... Office 2003 SP2 Professional Edition
I will always leave a good response to helpful postings... They are a lifeline! 
-
Feb 6th, 2006, 12:37 PM
#4
Re: Where is common dialog?
The commondialog control is included with VB 6 so does your development system have VB installed on it? That could be why its on one and not the other. You can download it from the VB6 runtime redistributables but then it will install all the runtimes, etc.
You can create a dialog of your own using VBA. .GetOpenFilename .GetSaveAsFilename
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 6th, 2006, 04:42 PM
#5
Re: Where is common dialog?
Office XP also comes with built in fileopen commands, but you will need the reference to MS Office itself for it to work correctly..
 Originally Posted by Access VBA Help
FileDialog Property
Returns a FileDialog object which represents a single instance of a file dialog box.
expression.FileDialog(dialogType)
expression Required. An expression that returns one of the objects in the Applies To list.
dialogType Required MsoFileDialogType. The type of file dialog box.
MsoFileDialogType can be one of these MsoFileDialogType constants.
- msoFileDialogFolderPicker
Example
This example displays the Save As dialog box.
VB Code:
Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog( _
FileDialogType:=msoFileDialogSaveAs)
dlgSaveAs.Show
This example displays the Open dialog box and allows a user to select multiple files to open.
VB Code:
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Feb 7th, 2006, 04:22 AM
#6
Thread Starter
Junior Member
-
Feb 7th, 2006, 05:41 AM
#7
Thread Starter
Junior Member
Re: Where is common dialog?
I've done some digging in the MSDN library after these wise words but there' still something I just can't find. Here's my code using the FileDialog Object:
VB Code:
Private Sub Backup_Click()
Dim fd As FileDialog
Dim FileDest As Variant
Set fd = Application.FileDialog(msoFileDialogSaveAs)
FileDest = ""
With fd
.InitialFileName = "backup.mdb"
.Title = "Backup records to..."
.Show
FileDest = .SelectedItems
End With
'Test for filename
MsgBox "You selected: " & FileDest
End Sub
... but the .Selected Items is wrong. Can you tell me what is the correct way to get the full path and filename into the variant 'FileDest'?
Ollie
Mess with the bull... You get the horns!
... Windows XP Home SP2
... Visual Basic 6 Professional Edition
... Office 2003 SP2 Professional Edition
I will always leave a good response to helpful postings... They are a lifeline! 
-
Feb 7th, 2006, 08:01 AM
#8
Re: Where is common dialog?
Quite simply add (1) at the end of SelectedItems
VB Code:
FileDest = .SelectedItems(1)
You can leave the .InitialFileName blank to force your users to specify a filename as well as the filepath.
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Feb 7th, 2006, 08:14 AM
#9
Re: Where is common dialog?
Incidently to display the Print Dialog so that your users can specify where to print to you can use..
VB Code:
DoCmd.RunCommand acCmdPrint
However it's not that simple.. It will depend on what you are trying to print.
I tend to use a sub procedure in a module that is called from anywhere within the database.. this then sets a flag for the report to specify whether or not to print or display..
VB Code:
Sub NewPrintingMethod(strReportName As String)
'Procedure will attempt to open the requested report for printing, allowing the user the option of choosing their printer before printing the report
On Error GoTo NewPrint_Err
DoCmd.OpenReport strReportName, acViewPreview
On Error GoTo 0
If ReportPrinted = False Then
If NoRepData = False Then
If vbYes = MsgBox("You have not printed this report, do you want to try again?", vbCritical + vbYesNo, "REPORT NOT PRINTED") Then
NewPrintingMethod strReportName
End If
Else
NewPrintingMethod strReportName
End If
End If
Exit Sub
NewPrint_Err:
'report contained no data try again
On Error GoTo 0
NewPrintingMethod strReportName
Exit Sub
End Sub
This is called with the name of the report to be printed.. the PrintingReport and NoRepData are two Public Defined Boolean Variables in the Same module. PritingReport is set to True and instead of opening the report for print view this sub is called like so..
VB Code:
PrintingReport = True
NewPrintingMethod "ReportName"
PrintingReport = False
Behind the report is the following code that handles whether or not the report is to be printed or to allow normal view..
VB Code:
Private Sub Report_Activate()
NoRepData = Not HasData
If NoRepData Then Exit Sub
If Not PrintingReport Then
DoCmd.Maximize
Exit Sub
End If
On Error GoTo Err_Report_Activate
DoCmd.RunCommand acCmdPrint
ReportPrinted = True
DoCmd.Close acReport, Me.Name
Exit Sub
Err_Report_Activate:
ReportPrinted = False
DoCmd.Close acReport, Me.Name
On Error GoTo 0
Exit Sub
End Sub
Private Sub Report_NoData(Cancel As Integer)
NoRepData = True
Cancel = True
End Sub
The NoRepData is handled inside the Report_NoData Event like above.. this forces the printing method to try again.. To stop this from happening I normally add a check on the report's source data before calling this sub to ensure that there is some data in the table/query for the report..
Hope this helps.
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Feb 7th, 2006, 11:15 AM
#10
Thread Starter
Junior Member
-
Feb 7th, 2006, 11:20 AM
#11
Re: Where is common dialog?
Hmmm
Should work with the (1).. if not try .SelectedItems.Items(1), or if using option base 0 then you will need to use (0)..
Or if in doubt just do
VB Code:
Dim i
'rest of your code
For i = 1 to .SelectedItems.Count
Msgbox .SelectedItems.Item(i)
Next i
The single line of code will not work in access as you will need to open the report first.. You can place that single line into the report_Activate event, but it will display the print dialog even when opening the report in page preview mode..
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Feb 8th, 2006, 01:47 PM
#12
Thread Starter
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|