|
-
Feb 15th, 2008, 01:38 AM
#1
Thread Starter
Hyperactive Member
[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:
If Typeof Ctrl is DTPicker then
...
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.
-
Feb 15th, 2008, 01:53 AM
#2
Frenzied Member
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
-
Feb 15th, 2008, 01:57 AM
#3
Thread Starter
Hyperactive Member
Re: Dtpicker problem, Please help Thanks
vb Code:
dim ctrl as control
dim ctl as control
For Each Ctrl in Me.Controls
If TypeOf Ctrl Is Frame Then
For Each Ctl in ctrl.Parent
If TypeOf Ctl is DTPicker Then 'ERROR OCCURED HERE
......
End If
Next
End If
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.
-
Feb 15th, 2008, 02:12 AM
#4
Frenzied Member
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
-
Feb 15th, 2008, 02:31 AM
#5
Thread Starter
Hyperactive Member
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.
-
Feb 15th, 2008, 02:58 AM
#6
Frenzied Member
Re: Dtpicker problem, Please help Thanks
Last edited by VBFnewcomer; Feb 15th, 2008 at 03:02 AM.
-
Feb 15th, 2008, 03:07 AM
#7
Thread Starter
Hyperactive Member
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.
-
Feb 15th, 2008, 03:13 AM
#8
Frenzied Member
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
-
Feb 15th, 2008, 03:31 AM
#9
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:
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
-
Feb 15th, 2008, 05:28 AM
#10
Thread Starter
Hyperactive Member
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.
-
Feb 15th, 2008, 05:43 AM
#11
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|