Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    May 2001
    Location
    indiana
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dim as control (Access 97)

    i was just wondering if there was a way to dim a string value, such as "Forms!Form1.Text1" as a control to reference later to enter a value? I can provide more information if needed, but i would just like this simple question answered. thanks in advance

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dim as control (Access 97)

    It isn't clear what you want to do. You can declare an object variable as a control, but the way you set it will depend on where you're setting the object variable. In any event, you would need the name of the control and the name of its parent form as separate strings so that you could later say:

    Set objCtl = forms(strFormName)!(strControlName)
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    May 2001
    Location
    indiana
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dim as control (Access 97)

    thanks a bunch charlotte! it worked fine!

    however, i had to remove the "!" from the statement because it was giving me some kind of error. the statement
    Set objCtl = forms(strFormName)(strControlName) worked perfectly.

    thanks again

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dim as control (Access 97)

    Sorry about that, it's one of the problems with air code. <img src=/S/blush.gif border=0 alt=blush width=15 height=15> The syntax is analogous to DBEngine(0)(0) referring to the default workspace and current database. You need punctuation only if you reference the specific collections by name (i.e., DBEngine.Workspace(0)).
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    May 2001
    Location
    indiana
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dim as control (Access 97)

    wow!
    again i am awed by the amount of knowledge you have in that brain of yours. i will pretend that i know exactly what you are talking about after your <img src=/S/blush.gif border=0 alt=blush width=15 height=15>smiley [img]/forums/images/smilies/ohmy.gif[/img]). you have helped me several times in the past and i would like to thank you once again for gettimg me out of a tight spot [img]/forums/images/smilies/ohmy.gif[/img])

Posting Permissions

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