Results 1 to 6 of 6

Thread: [RESOLVED] Passing A Flexgrid To A Function

  1. #1

    Thread Starter
    Hyperactive Member rplcmint's Avatar
    Join Date
    Jan 2001
    Location
    Stockton, CA
    Posts
    333

    Resolved [RESOLVED] Passing A Flexgrid To A Function

    I'm having problems doing this:

    I have a MSFlexgrid sitting on a tabbed form named "grdTrans" and a disconnected recordset "rs".

    When I pass this grid to a module function "PopulateGrid(ByRef oFlxGrid as MSFlexGrid, ByRef rs as ADODB.Recordset) " it doesn't work.

    Seems like the grdTrans object is only viewed as a zero length string or something rather than an object. The recordset seems to be ok.

    I tried "Call PopulateGrid (grdTrans, rs)" as well as "Call PopulateGrid(Me.grdTrans, rs) both with no luck.

    Can you pass objects to functions in VBA?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    What do you mean by it doesn't work? Do you get an error? Do you not get what you expect? How do yo uknow it's not working?

    Also, can you post the code that's "not working?" -- would be a little easier to understand what you are doing.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member rplcmint's Avatar
    Join Date
    Jan 2001
    Location
    Stockton, CA
    Posts
    333
    I know it's not working because:

    "Seems like the grdTrans object is only viewed as a zero length string or something rather than an object."

    It's not an object, it has no properties to work with, it comes as a string with no length ----"". That's all i see.

    And of course it will error out if you set up your code to handle objects rather than strings.



    I got the problem down to this: When I try to use VB controls like a combo box or MSFlexgrid , the properties such as addItem and RemoveItem, TextMatrix, Col, Row, etc of the control is not listed and hence it gives a compilation error.

    I would like to know what the action to be taken to get the properties identified.
    Last edited by rplcmint; Aug 25th, 2004 at 08:31 AM.

  4. #4

    Thread Starter
    Hyperactive Member rplcmint's Avatar
    Join Date
    Jan 2001
    Location
    Stockton, CA
    Posts
    333
    I have a clue to the problem - Unbound Apps (.mdb) versus Access Projects (.adp). There is a definite problem with referencing the control within a .adp Access application.

    For example:

    I'm dropping a MSFlexgrid on a form in Access .mdb ...(Unbounded technique)

    I can see the properties such as

    Me.MSFlexgrid.Col = 1
    Me.MSFlexgrid.Row = 2

    Me.MSFlexgrid.TextMatrix(5,2) = "Some string value"

    This all works for me.


    When I start a ".adp" Access project and drop a grid on a form, I can't see the properties.

    Me.MSFlexgrid (Then no recognizable properties for this control)!!!

    Does .APD Applications handle controls different than Unbound Access apps?

    This is some frustrating stuff!!
    Last edited by rplcmint; Aug 25th, 2004 at 09:37 AM.

  5. #5
    Member
    Join Date
    Jul 2003
    Location
    London
    Posts
    44

    Simple response

    There should be a simple response to this. I used to have this problem with non-VBA controls in MSAccess and not seeing their properties or passing them to functions, but there is an answer.

    VB Code:
    1. Dim g as MSFlexGrid
    2. Set g = g.Object
    3.  
    4. call PopulateGrid(g,rs)


    Hope that helps

  6. #6
    Member
    Join Date
    Jul 2003
    Location
    London
    Posts
    44

    *************** Error *********

    Sorry that should have read
    VB Code:
    1. Dim g as MSFlexGrid
    2. Set g = grdTrans.Object
    3.  
    4. call PopulateGrid(g,rs)

Posting Permissions

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



Click Here to Expand Forum to Full Width