|
-
Jun 27th, 2005, 01:10 PM
#1
Thread Starter
Frenzied Member
Need help... ready to kill M$
I have recently created a DB using office 2003, but used the 2000 format so my other users wouldn't run into conflicts. Ofcourse that wasn't the case. When another user opens the database, they get an error saying there is a broken reference to comdlg32.ocx, which one of the files for the common dialog control. When I go to the reference dialog box it says MISSING: Common Dialog control 6.0 (SP6). Does anyone know how I can restore this? I saw on the Microsoft site a similar problem but it just said to recreate the controls with the same name as before. The problem is, I don't have the control in my toolbox to recreate them.
help plz
-
Jun 27th, 2005, 01:27 PM
#2
Re: Need help... ready to kill M$
Try manually reinsert it first: go to Components and navigate to System32 folder and select comdlg32.ocx and say OK. If it doesn't work then reinstall VB.
In any case SAVE A COPY of your project before changing it in a different folder !!!
-
Jun 27th, 2005, 08:04 PM
#3
Re: Need help... ready to kill M$
The comdlg32.ocx is not a standard Access control. It must have been added through the toolbox as an additional control from
a system that has VB6 installed on it. You can add just about any VB6 control to the Office's toolbox, but you will need to distribute it
along with your db.
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 
-
Jun 28th, 2005, 08:21 AM
#4
Thread Starter
Frenzied Member
Re: Need help... ready to kill M$
How would I distribute it with my DB? Sorry if that is a dumb question, never did it before.
Right now I was able add it on one PC, but I had to browse through the network to my PC to find the .ocx. Is there a better way to do this?
-
Jun 28th, 2005, 01:32 PM
#5
Re: Need help... ready to kill M$
Maybe you could create a small setup package to copy the db, the ocx, register the ocx, and be done.
You could also just write a batch file to copy and register the ocx. Setup a netword share to contain the db and ocx.
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 
-
Jun 29th, 2005, 03:55 AM
#6
Re: Need help... ready to kill M$
I'll help you kill ms...
Stoopid excel text import depending on regional settings (mutter)
Ok, for your common dialog problem, as you have seen it is a pain to set up all the comps to use the active x control - there is an alternative.
API
Yup, the common dialog active x control just wraps the api calls, and there are loads of types of coding around to do the file selection/colour selection (and even printer selection althoughI haven't used that - yet).
Below is some code for a module (say mdlApis)
Code:
Option Compare Database
Option Explicit
'---- Other useful vars
Public Const MaxDWord As Double = 4294967295#
Public Const mMax_Path = 4096
'---------------
'---- Types ----
Public Type typOpenFilename
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Type typChooseColor
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
'---- General timing function/api - useful
Public Declare Function apiGetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
'---- common dialog stuff :)
Public Declare Function apiGetOpenFilename Lib "comdlg32.dll" Alias "GetOpenFileNameA" (ptypOpenFilename As typOpenFilename) As Long
Public Declare Function apiGetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (ptypOpenFilename As typOpenFilename) As Long
Public Declare Function apiGetChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (ptypChooseColor As typChooseColor) As Long
'---- my design based on MS Help - Selects a colour using the common dialog box
Public Function ColourSelection(Optional lngFlags, Optional lngInitColour) As Long
'---- Uses the common dialog box / colour selection
'---- usual flags are : 1 - starting colour specified, 2 - full open
'---- so use 3 as the flag every time
'---- Returns :
'---- -1 : Failed/cancelled
'---- >=0 : colour in long
Dim cChoose As typChooseColor
Dim lngRes As Long
Dim intI As Integer
Dim bytCols As Byte
On Error Resume Next
ColourSelection = -1
With cChoose
'---- default info
.lStructSize = Len(cChoose)
.hwndOwner = 0
.hInstance = 0
.lpCustColors = StrConv(bytCols, vbUnicode)
'---- optional bits
.Flags = 0
.rgbResult = 0
If Not IsMissing(lngFlags) Then .Flags = lngFlags
If Not IsMissing(lngInitColour) Then .rgbResult = lngInitColour
lngRes = apiGetChooseColor(cChoose)
If lngRes > 0 Then ColourSelection = .rgbResult
End With
If Not Err.Number = 0 Then ColourSelection = -1
End Function
'---- Selects a/several file(s) using common dialogs
Public Function FileSelection(ByVal strInitDir As String, ByVal lngFlag As Long, ByVal strFilter As String, ByVal lngFilterIndex As Long, ByVal blnOpen As Boolean, Optional strTitle, Optional strFileExtension, Optional lngOwnerHwnd) As String
'---- Selects one or more filenames
'---- Requires
'---- inital directory to open in
'---- flags for opening
'---- usual flags are :
'---- &H200000 - use long filenames
'---- &H80000 - Explorer type window
'---- &H200 - multi select
'---- &H4 - hide read only option on box - v useful
'---- &H8 - force same dir as when opened
'---- &H1000 - file must exist - useful for opening
'---- usual I use : &H280004
'---- Returns a string holding either :
'---- nothing
'---- path and filename
'---- path chr$(0) filenames separated by chr$(0)
'---- NOTE : current max chars = 257 ... I think expand if neccessary
Dim strTemp As String
Dim lngReturn As Long, lngP As Long, lngO As Long
Dim cOpenFilename As typOpenFilename
On Error Resume Next
With cOpenFilename
'---- Default values according to another developer
.lStructSize = Len(cOpenFilename)
.hInstance = 0
.nFilterIndex = 1
.nFileOffset = 0
.lpstrFile = String(5000, 0)
.nMaxFile = Len(.lpstrFile) - 1
.lpstrFileTitle = .lpstrFile
.nMaxFileTitle = .nMaxFile
If Not IsMissing(strFileExtension) Then .lpstrDefExt = strFileExtension
'---- Bits like the common dialog control
If blnOpen Then
.lpstrTitle = "Open a file..."
Else
.lpstrTitle = "Save file as..."
End If
If Not IsMissing(strTitle) Then .lpstrTitle = strTitle
'---- messing
'---- default filter
'---- each filter is separated by a character of 0 - Name - filter - name filter (etc..)
'---- example :
' .lpstrFilter = "All Files" & Chr$(0) & "*.*" & Chr$(0) & "Text Files" & Chr$(0) & "*.txt;*.csv"
'---- replace filter with the selection chosen by the programmer...
.lpstrFilter = "All Files (*.*)" & Chr$(0) & "*.*"
lngO = 1
lngP = InStr(1, strFilter, "|")
If lngP > 0 Then
strTemp = ""
Do Until lngP = 0
strTemp = strTemp & IIf(Len(strTemp) > 0, Chr$(0), "") & Mid$(strFilter, lngO, lngP - lngO)
lngO = lngP + 1
lngP = InStr(lngP + 1, strFilter, "|")
Loop
strTemp = strTemp & Chr$(0) & Right$(strFilter, Len(strFilter) - lngO + 1)
Else
strTemp = strFilter
End If
.lpstrFilter = strTemp
.Flags = lngFlag
.hwndOwner = 0
If Not IsMissing(lngOwnerHwnd) Then .hwndOwner = lngOwnerHwnd
'---- remark out the next line - or amend it as applicable
If .hwndOwner = 0 Then .hwndOwner = Application.hWndAccessApp
.lpstrInitialDir = strInitDir
End With
'---- is the dialog box an open or save?
If blnOpen Then
lngReturn = apiGetOpenFilename(cOpenFilename)
Else
lngReturn = apiGetSaveFileName(cOpenFilename)
End If
'---- send back the selected file(s)
If lngReturn = 0 Then
FileSelection = ""
Else
FileSelection = RemoveNonPChars(cOpenFilename.lpstrFile)
End If
End Function
Public Function RemoveNonPChars(ByVal strText As String) As String
'---- gets rid of the extra chr$(0)'s in the text
'---- by looking for two chr$(0)'s together (only happens at the end...)
'---- NOTE : only removes those at the end of the string - for multi means that you can get the filenames...
Dim lngP As Long
On Error Resume Next
RemoveNonPChars = " "
If Len(strText) = 0 Then Exit Function
lngP = InStr(1, strText, Chr$(0) & Chr$(0))
If lngP > 1 Then RemoveNonPChars = Left$(strText, lngP - 1)
If Not Err.Number = 0 Then
RemoveNonPChars = " "
Err.Clear
End If
End Function
I think it is all in there. Have a play and see if that helps. If not, go with RobDoggs registering post...
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
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
|