Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Oct 2009
    Location
    Bali
    Posts
    9

    Unanswered: MouseDown events arguments (List & TreeView)

    Hello all!

    I too frequently meet the classic "Procedure declaration does not match........" error with mscomctl ListView and Treeview in my Access2003 project with VBE6.

    Most cases could be solved for OLEDragOver and OLEDragDrop.

    But nothing seems to work with MouseDown (I need to implement a context menu on right-click).

    Could you use your magic stick on:

    Code:
    Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    end sub
    
    Private Sub ListView1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, x As Single, y As Single)
    end sub
    
    Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As OLE_XPOS_PIXELS, y As OLE_XPOS_PIXELS)
    end sub
    
    Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As stdole.OLE_XPOS_PIXELS, y As stdole.OLE_XPOS_PIXELS)
    end sub
    Why so many discrepancies for the arguments syntax when you insert MS ActiveX in an Access project???

    So much time wasted!

    Thank you for your help!

    phil

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I personally avoid using the TreeView ActiveX. Too many problems and difficult to code (which I wasted on many years ago.) The only activeX control I use by MS is the calendar control. There is a treeview example posted somewhere in the code bank though.
    Last edited by pkstormy; 02-01-10 at 23:16.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Oct 2009
    Location
    Bali
    Posts
    9
    Hello pkstormy!

    Thank you for dropping a note!

    You must be right somewhere... I also considered looking for other TV's on the market last year, but I couldn't make a choice (maybe you could help me out some day?...) and I therefore stayed with MS' TV and LV...

    Right you are as well, regarding the calendar!!!... I had to tame DTPicker (we can't work w Access 2007, that doesn't even let our users create their new Replicas, sync only, isn't that crazy?...) And have you ever seen a f....ing control like DTPicker that you have to make visible b4 you can set its Now() value, min and max dates, then hide it again? :-)

    Well, I am not too bad with MSComCtl Treeview... max 30,000 nodes is ok, no link to the underlying data, but that's fine w me.

    Lots of SQL and coding (1.1mil records, 24 levels in TV, long NodeKey's to de-concatenate). Filling on demand for large recordsets is smooth, API to set nodes and BG colors, no italic font, and so on and so on... But it's done and the app works fine and fast!

    Drag-and-drop works very fine with buddy ListView, no twips/pixels issue to fix on hittest, no use of the 'Data as Object' stuff, just pure SQL... Reliable and never crashes...

    Very last problem to solve is really this MouseDown arguments issue in Access!

    BTW does anyone have a copy of comctl198.chm??? Would love to see it after a year without the thinnest Help!!!


    phil

  4. #4
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    I can't say I've come across this one in my years tussling with the MS TreeView in Access forms, but I've got one observation - wouldn't it be better to show a context menu with MouseUp? I suffered all sorts of problems until I made my action the last one to be handled by this, or any other, custom control...

  5. #5
    Join Date
    Oct 2009
    Location
    Bali
    Posts
    9
    Hello New Flavor!

    It would be so nice... but no: same "Procedure declaration doesn't match..." error on MouseUp and MouseMove!!!!

    Frustrating!

    Fumbling in the dark... Same error when I start with a new, empty mdb project... Could it come from a compatibility issue between different Office and VBE6 versions???

  6. #6
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Ahh... When weirdness occurred with VB6 components, I'd create a small VB6 project with a blank form and references to all the OCX files containing the custom controls.

    Sometimes a machine upgrade, OS hotfix or other application deployment broke mdb files referencing custom controls. The fix was to reinstall the OCX files using the project setup.exe before opening an unopened backup copy. The original broken file would still be knackered, but the backup copy would be fine. It seems Access resolves the references first time round, but not when opened subsequently...

    You could give it a whirl.

    PS this even worked on Vista machines, although you'd have to create the VB6 project in Visual Studio on XP - VMWare is my friend!

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Converting from VB6 to VBA and the way MSAccess form design works is a bit different if you've done any prior VB6 designing (I sensed some frustration in your post.) In MSAccess, you don't often use the mousedown and other events as you would in VB6. Instead, you might utilize events such as AfterUpdate on a field, listbox or combobox. Mousedown events are often difficult to overcome if for example you should instead be using the OnClick event or trying to do something as simple as preventing the scroll wheel from scrolling to a new record. The MSAccess wizard is actually useful for creating different action type buttons and seeing how they look coding wise. But there is often another way to acomplish the same task such as scrolling to a new record (ie. Make the form so it only returns 1 record and then in the OnCurrent event, add some code such as: Docmd.gotorecord,,acfirst) There's little tricks which seem forever to find a solution but it usually ends up being a couple of lines of codes based off the correct event. I struggled when converting from vb to vba with each of the events and would often put in a msgbox such as msgbox "OnClick Event Fired" in the code for each event to see when they fire.

    To avoid problems in MSAccess, especially since upsizing an MSAccess application works very poorly with specialized or non-standard (including ones from Microsoft), I don't utilize OCX and other activeX controls (but I do have an example of using the calendar control in the code bank which I use in every application.) All I do is open the form (and then populate the formName, fieldname), and it updates the calling form's date field which is nice because it's a simple method with only a few lines of code and totally re-usable to be called from any form in my app.

    I also have a set of non-problematic modules/API calls/class modules I re-use which are also posted in almost every one of my examples. The examples I posted throughout the code bank are ways where I found an easier method versus dealing with things such as OCX and activeX controls, including examples of simple methods to set a wide variety of colors on the user's desktop (see the CardFile example posted in the code bank.) This actually let's the user select a left hand side of the screen color and right hand side of the screen color and will blend the color scheme on the form (saving the user's personal settings). It's kind of neat and is easy to do with a simple module I imported and tested on several different systems. How it works in MSAccess 2007 though is unknown since they changed a bunch of things in 2007 which don't always work nicely with non-standard modules. Most of the other re-usable modules are from the MSAccess Developers Book by Sybex (a great resource of non-problematic coding examples.)

    Note also: The FormManipulation example let's you do things with an MSAccess form you thought you never could do. Better than any OCX control., The Excel/Crosstab view query in a subform is also especially helpful with a nice easy way to create reporting queries and allow the user to export those totals., etc...etc...

    I hope the examples help. Each developer learns/develops a specific way of doing things. I based my methods taught by a lot of the principles in the Developers Book and how I've learned to code by myself and seeing different ways by others and improving on them.

    Also note: Most of my examples are ADO type coding which I find to be much easier than DAO. To each his own on the type.

    I hope that helps.
    Last edited by pkstormy; 02-02-10 at 21:56.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  8. #8
    Join Date
    Oct 2009
    Location
    Bali
    Posts
    9
    Dear New Flavour and pkstormy!

    Thank you very much for your posts and all your excellent suggestions! I will definitely use them and call you again!

    Well, in this case I just found the right parameters for the Mouse (and also for the Key) Up and Down events! It had to be

    Code:
    Private Sub ListView1_MouseDown(ByVal Button as Integer, _
                  ByVal Shift as Integer, ByVal x as Long, Byval y as Long)
    
        'Whatever...
        If Button =2 Then Msgbox "Right Click"
    
    end sub
    No more error, it works!

    Actually, everything was within Access VB Window itself!

    My mistake was to always follow what the Object Browser says (e.g.: "x as OLE_xPos_PIXELS"), whereas you would often be better off using the alphabetical Procedures/Events Combo Box on top-right of the Code Window!!!!

    The right parameters are there!

    And, surprise, the X and Y had to be LONG!!!!!!!!!!!! Don't ask me why!

    Lucky for this time...! Let's do this new context menu and test it on users' machines! I will let you know!

    Oh yes, regarding Vista, I found that many Sony Valio Laptop owners have a slightly different VBE6.dll...... My app cannot work on these machines... ("This VB Project is corrupt" error message, which BTW I find less than polite from MS!). On Acer, Toshiba, HP everything goes fine. Have you ever noticed similar problems on your side???

    All the best and many thanks again!

    phil

  9. #9
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    MSAccess error messages

    There's definitely a LOT of ambiguaty in MSAccess errors. For example, "The locked by another user" error is often confused with table/record locks when it's actually the associated *.ldb file causing the lock for multiple users. After a while, you tend to learn all the different kinds of errors and what they REALLY mean versus what they are interpreted as. An error like "This VB Project is corrupt" would lead me to believe that something isn't compiling like it should or is related to a different OS, MSAccess version, or installation problem (such as registering the OCX) versus manufacturer specific. A lot of unknowns when you throw different, non-typical activeX controls and such into the mix and hence why I avoid them as best as I can.

    When you start troubleshooting things such as VBE6.dll problems or other dll errors, it can be a real pain. Especially if you're using external OCX controls and such along with different OS's. And there's not a lot of help others can give you unless they've used the same kind of control or used the same method using the same OS or MSAccess version. This can be be very frustrating (you feel like you're exploring different areas on your own.)

    It's usually a problem where it doesn't work with the OS or MSAccess version (or ODBC version if using ODBC) or corrupt installation on the computer itself and I've never really found anything (error-wise) to be related to a specific computer manufacturer (ie. Acer versus Toshiba versus HP, etc..) that is the cause.

    I guess though if you're doing things such as determining where the mouse pointer is moving then the type of mouse driver used along with screen settings, pixels, and other things can play a role. I've seen where a specific mouse driver can be the problem for some computers or specific activeX type of controls but only in a few cases.

    I've also seen things such as programs in the startup or other programs opened by the user (even screen savers) which can interfere with non-typical controls, especially ones which do any kind of API type calling. I don't trust using these and again, avoid any non-typical basic controls unless there's absolutely no other alternative (and I've always found an alternative using standard controls). If I get an error such as you've described, I might look at what other programs are running on those specific computers when your app is opened, drivers, type of OS, and other versioning issues (which might cause the problem) versus it being manufacturer specific.

    It really pays off if you know that your app doesn't work when a user is running a screen saver or using a different mouse driver, or other driver, or their screen settings are different, versioning issues, or they're running another process which conflicts, etc....etc...
    Last edited by pkstormy; 02-03-10 at 14:22.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  10. #10
    Join Date
    Oct 2009
    Location
    Bali
    Posts
    9
    Dear pkstormy!

    Thank you so much for all these interesting considerations! That will help me a lot to address further problems on users' machines; your comments about mouse drivers are most interesting! Thank you very much!

    Unfortunately, I had no time the other day to try an empty mdb (no ActiveX) on these Valio machines with Vista. That could indeed have proven your case!

    Let's recognize anyway that these users are also VERY upset by the OS, and that they only keep it for a while for a few very subjective reasons (more sexy Powerpoint, usually...). They eventually either come back to XP, or give a try to W7...

    Well, I just tested our latest mdb with LV and TV context menus (CommandBars("MyMenuName").ShowPopUp) on two computers with XP, and it works very fine so far. Ouuuf!

    (You can now just Google "shift as integer, x as Long" -instead of as Single-, to find many good samples around!).

    I understand your advice to avoid ActiveX controls. It is very sound. But the decision is also so much driven by the kind of data you handle, and also by your users' request!

    In my case (a Taxonomy and Biodiversity Monitoring app), I started to query and display Phylogeny groups in Combo and List Boxes. Believe me, with 22 Taxonomy levels (Kingdom down to Subspecies), the look was absolutely ugly. And the RowSource code properly unmanageable... A true relief for everybody when I started using TV's and LV's...! What else would you do?

    I had indeed to get rid of MS' "Form 2.0" dll, with its ridiculous spin buttons and other gadgets. This one sticks like hell to you project and can never properly register! (also "cannot remove reference, currently in use..."!!!!)

    Another couple of progress bars and DTPickers, plus the common dialogs do no harm...

    Last ActiveX is for pictures (the very good DBPix2.0, from UK) that I have been using for 2 years now without the slightest problem, much nicer and faster than MS ListView's Icons anyway.

    All these controls live together very peacefully on some 25 computers...

    The REAL problems I meet with ActiveX come with ESRI's map, scene and globe controls. We are working with the company to improve their 9.3 run-time. It is the one that causes troubles on almost any VBA string function. But i am not a programmer at all (vet and zoologist actually) and I have to wait for more clever people than me to find a fix... Patience!

    I will read your posts again and again!

    Programming is fun!

    phil

  11. #11
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    "In my case (a Taxonomy and Biodiversity Monitoring app), I started to query and display Phylogeny groups in Combo and List Boxes. Believe me, with 22 Taxonomy levels (Kingdom down to Subspecies), the look was absolutely ugly. And the RowSource code properly unmanageable... A true relief for everybody when I started using TV's and LV's...! What else would you do?"

    When I had to do something like this, I used a combination of some 'categorizing' type buttons at the top 2 or 3 rows of a listbox with a query name. Which once the user clicked on an item in the listing, I had a neat function which looked at what the rowsource query name was and depending on the query name, made specific buttons at the 2nd or 3rd row invisible or visible, showing other buttons to go into further details (and hence, a user could go virtually an unlimited levels deep or different combinations into the recordset, seeing different data at each level.) It also had a subform to the right which showed any specific details for the selected record (the function would repopulate the sourceobject of the subform.) It worked very nicely and only took a few dozen buttons positioned correct (ie. a user could click Patient and would then see certain buttons related to a Patient (ie. Medical Records, Personal Records, etc..)along with a listbox showing patient names. They click on a specific patient, and the listbox get's a different rowsource showing either additional items to select from (which either duplicated the buttons or gave new options) or they'd see further details relating to any other data they wanted to see.

    It worked very well once I got all the coding in place and the user's liked the ability to drill "downward" so to speak in levels using either the buttons or the menu's in the listbox. I noticed they could quickly get to any record they needed from any table. On another project, I even added a 2nd listbox below the 1st listbox to offer a additional level of detail along with a nice menu in the top listbox. Setting the buttons to different colors (or the listbox backcolors) really made it a hit.

    I liked it because I didn't need to use any special controls - just buttons and listboxes and a subform. The trick was to set it up so the user could just click a button, see the next level button in the same spot (or make visible specific buttons in the 2nd or 3rd row), continue clicking (on the next row and see new options in the 3rd row or in the listbox), and make it flow nicely for the user. Some user's had to get used to it but I got a lot of compliments that once they did it a few times, they liked it better than any other method I had tried (including using a treeview control) and could drill through the records faster than they could ever do in any program. The coding was fairly easy by determing the query rowsource name in the listbox (or I populated a hidden text field) and a bunch of case statements to show what buttons or how to re-populate the listbox or subform.
    Last edited by pkstormy; 02-04-10 at 00:08.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  12. #12
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I did some ESRI's mapping once. I populated (geocoded) all the lats/longs in the customer table (along with senate/assembly districts I imported into ESRI). I would then often just run ArcMap separately and link it to the dataset to produce spatial maps. Nowadays, I hear there's other programs which are much easier to work with. ESRI is pricey and it was a pain installing 10 disks of address updates every 6 months. I would've hated to try and embedd an activeX type of control to speak with ESRI Map (ArcMap is what I think it used to be called). That would be a pain, especially the way it works with spatial positioning. I heard google does a much better automated way of calculating the correct spatial view but it isn't as flexible.

    If it was an option, I might consider passing parameters into an embedded Internet Explorer control, passing values to open the google spatial map (or preferably shell to a google map session in IE versus embedding it). But I don't know all your requirements.
    Last edited by pkstormy; 02-04-10 at 00:21.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  13. #13
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    As far as the pics, (I'm assuming button type pics), I have a wide collection of icons I've collected (along with bmp images) which I use for the pics. I'm usually substituting the MSAccess default icon and putting in pics related to the specific program.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  14. #14
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    CommandBars("MyMenuName").ShowPopUp - there's some neat ways to show these in the code bank. You can even tie them to specific popup forms and set them up any way you want.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  15. #15
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Here's some examples from the code bank:

    Calendar example: http://www.dbforums.com/6274874-post30.html

    Right-click menu bar: http://www.dbforums.com/6275952-post32.html

    Menu System (ie. removes all MSAccess info and ONLY shows the form on the user's desktop. User can see their other icons around the form: http://www.dbforums.com/6291638-post40.html

    Form Manipulation (oval, circle, translucent, hidding caption, making a form fill the entire screen (even over taskbar): http://www.dbforums.com/6301669-post51.html

    (you can make some really neat looking forms by hidding the caption and using a translucent form positioned correctly over another from. Get's even neater if you place a blank (no fields) translucent form over another form and make it red, blue or green.)

    How to populate query results into a subform: http://www.dbforums.com/6303905-post54.html

    Color Transition: http://www.dbforums.com/6310284-post59.html

    Card File (demonstrating color transition): http://www.dbforums.com/6326391-post64.html

    TreeView example: http://www.dbforums.com/6326489-post65.html

    Cool Menus: http://www.dbforums.com/6351329-post72.html

    There's lots more if you're interested. Hopefully at least one will be helpful.
    Last edited by pkstormy; 02-04-10 at 00:55.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •