Results 1 to 11 of 11

Thread: [RESOLVED] Dtpicker problem, Please help Thanks

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Resolved [RESOLVED] Dtpicker problem, Please help Thanks

    Hi all,

    Happy Chinese New Year, can anyone help me to solve the problem ?

    Why the error appear when I compile the code as below.

    vb Code:
    1. If Typeof Ctrl is DTPicker then
    2.        ...
    3.   End If

    Error Message : Compile Error :
    A module is not a valid type


    Why this error appear and how to solve it ?

    Thanks for help :-)
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Dtpicker problem, Please help Thanks

    Are you using like this... And where are you using the code in form or module
    Code:
      For Each ctl In Me.Controls
        If TypeOf ctl Is DTPicker Then
          Print "DTP"
        End If
      Next

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Dtpicker problem, Please help Thanks

    vb Code:
    1. dim ctrl as control
    2. dim ctl as control
    3.  
    4.      For Each Ctrl in Me.Controls
    5.           If TypeOf Ctrl Is Frame Then
    6.               For Each Ctl in ctrl.Parent
    7.                   If TypeOf Ctl is DTPicker Then   'ERROR OCCURED HERE
    8.                      ......
    9.                   End If
    10.               Next
    11.           End If
    12.      Next
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Dtpicker problem, Please help Thanks

    Dim ctl As Control

    Code:
      For Each ctl In Me.Controls
        If ctl.Container.Name = "Frame1" Then
            If TypeOf ctl Is DTPicker Then
               Print "DTP1"
            End If
          End If
      Next

  5. #5

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Dtpicker problem, Please help Thanks

    I had tried your method,
    The Error Still Occured.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  6. #6
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Dtpicker problem, Please help Thanks

    Last edited by VBFnewcomer; Feb 15th, 2008 at 03:02 AM.

  7. #7

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Dtpicker problem, Please help Thanks

    I been rated you, Thanks you help.
    However for the 1st link you provided to me, I think that was not my main problem cause i didnt using ms access..
    For the second problem, I not really understand furthermore the last post also didn't have any resolution .


    Thanks ...
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  8. #8
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Dtpicker problem, Please help Thanks

    I been rated you, Thanks you help
    . If I could not help you why rate me
    Pls start a new proj add a frame (Frame1) and place one DTP in it, and run the snippet at #4 (you may add other controls) and post back

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Dtpicker problem, Please help Thanks

    sounds like you must have a module with the name DTPicker as well
    i tested that it will definitley give that error

    try this instead
    vb Code:
    1. If TypeName(ctl) = "DTPicker" Then 'do stuff
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  10. #10

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Dtpicker problem, Please help Thanks

    GODLIKE !!
    You had solved my problem.
    I found that i got another modules name same as my control classname.

    Thanks a lot ...
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  11. #11
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: [RESOLVED] Dtpicker problem, Please help Thanks

    I had a doubt something else is interfereing thats why I recommended you to start a new proj and test

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