Full Version: Common Dialog
UtterAccess Forums > Microsoft® Access > Access Forms
aoh
Hi guys,
started working today on a database for a big company. For various reasons specific to the company, they're working in Access97 and the next major project (after this one) is to upgrade to 2003 (I hope - and I'm pushing).
They've also got a very specific spec, (and a very bloated timeline - I did six days work today and left at 3.00???) but, basically, nothing is to be changed unless it applies to the project at hand.
The database as it stands uses a CommonDialog box to select a file for import which I've never before. When the users do it, it works fine, but when I run it on the development machine, I get an error 438 - object does not support this property or method. As this is the first line of the process I need to change, I have to get it running - preferably as is.
Anyone know what I need to install / tick / add-in to get this working?
Thanks
RuralGuy
Are you using this API? Call the standard Windows File Open/Save dialog box
aoh
RG,
So, I'd love to - just so I could understand it better. The code falls over on the red line:
CODE
   ' Set the Common Dialog Control properties
[color="red"] Form_Switchboard.cdFindFile.DialogTitle = "File Import"  [/color]  
  If UCase(sImportType) = "FILE1" Then
    Form_Switchboard.cdFindFile.InitDir = SelectDrive & "input files\file1\"
    Form_Switchboard.cdFindFile.Filter = "CSV Files (FILE1*.csv)|FILE1*.csv"
  Else
    Form_Switchboard.cdFindFile.InitDir = SelectDrive & "input files\file2\"
    If UCase(sImportType) = "FILE2" Then
      Form_Switchboard.cdFindFile.Filter = "CSV Files (FILE2*.csv)|FILE2*.csv"
    Else
      Form_Switchboard.cdFindFile.Filter = "CSV Files (FILE2A*.csv)|FILE2A*.csv"
    End If
  End If
  Form_Switchboard.cdFindFile.FileName = ""
  Form_Switchboard.cdFindFile.Flags = 4
  Form_Switchboard.cdFindFile.CancelError = True
  Form_Switchboard.cdFindFile.ShowOpen

The cdFindFile on the Switchboard is an ActiveX Control and the data properties are:
OLE Class: CommonDialog
Class: MSComDlg.CommonDialog.1
Enabled: Yes
Ocan figure out what this code is doing - I just can't get it to run. I'd rather change it to the standard API call, but I'm going to have to give them a good reason, seeing it works for the users.
RuralGuy
Do you have any MISSING references? I'm not sure if that ActiveX Control came with ac97. I use ac2K2. It may be a simple as registering the ActiveX control on your machine.
HiTechCoach
I only use the standard API call because is will work on any machince with any version of Windows without having to be sure that the exact Common Dialog control has been installed. WWith the standard API call I have never had any problem getting it to work on any PC. This is not true with your method.
aoh
None missing - and I added in ActiveX Plugin, ActiveX Data Objects Recordset 2.8 Library, ActiveX Data Objects (Multi-Dimensional) 2.8 Library and ActiveX Data Objects 2.8 Library but I'm still getting nowhere.
SO wish they'd done these two projects the other way around - then I could have re-done the entire database (loads of macros and code that offends my senses when I'm trying to wade my way through it) and THEN made these changes.
thanks.gif for the pointers RG.
Hi-Tech, I take your point, but if it works for the users, I'm not sure they're going to appreciate me charging an extra day or so to change it just now. Then again, given the bloat, I should be able to do it within the original timeline.
(Thinking with my keyboard here)
I'll have a chat with the boss tomorrow and see how they feel about it. It's either a day changing it to code that is standard and works anywhere or a day (at least) trying to get something "different" to work on a development machine just so I can get past one line. Mmmm - I just might get away with this one thanks.gif
RuralGuy
Look at the references on the machines that work and note the difference. The ActiveX control is obviously on those machines.
aoh
Will do RG - I managed to delete that line from my last post. I'l compare the two and see if it's easy, but if it's not, I'll push for the standard API calls.
RuralGuy
Sounds like a good plan Anne. Good luck! thumbup.gif
HiTechCoach
Anne, Good luck on your project!
aoh
Well, it worked! I looked at the references on the user machines, and they had a couple which I didn't, but setting them made diddly-squat difference.
gave the boss a choice of spending who knows how long on TRYING to figure it out, or one day of fixing it so it works anywhere.
I've now got the imports working - just need to adjust the code for the exports and I'm ready to start what they're supposed to be paying me for in the first place.
Thanks for the help guys - you were both quoted in my pleas yayhandclap.gif notworthy.gif
RuralGuy
Outstanding!! It was the correct choice for them to make!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.