|
-
Aug 2nd, 2007, 11:15 AM
#1
Thread Starter
Member
Type mismatch
I am getting this error while trying to use the control...
"Type mismatch "
The function is:
Private Sub Command1_Click()
'ways(routeList.ListIndex).timeOpen = timeConvert(Trim(timeStart.Text))
'ways(routeList.ListIndex).timeClose = timeConvert(Trim(timeEnd.Text))
ways(routeList.ListIndex).timeOpen = Format(Trim(timeStart.Text), "hh:mm AMPM")
ways(routeList.ListIndex).timeClose = Format(Trim(timeStart.Text), "hh:mm AMPM")
target = fillTime(routeList.ListIndex)
End Sub
===>The error place
schedway = ways
-
Aug 2nd, 2007, 11:19 AM
#2
Re: Type mismatch
 Originally Posted by emmim44
I am getting this error while trying to use the control...
"Type mismatch "
The function is:
Private Sub Command1_Click()
'ways(routeList.ListIndex).timeOpen = timeConvert(Trim(timeStart.Text))
'ways(routeList.ListIndex).timeClose = timeConvert(Trim(timeEnd.Text))
ways(routeList.ListIndex).timeOpen = Format(Trim(timeStart.Text), "hh:mm AMPM")
ways(routeList.ListIndex).timeClose = Format(Trim(timeStart.Text), "hh:mm AMPM")
target = fillTime(routeList.ListIndex)
End Sub
===>The error place
schedway = ways
Two questions, first at what line do you get the error and second, what error are you getting? Please use the Highlight Tags when posting your code, it makes it a lot easier to read.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Aug 2nd, 2007, 11:22 AM
#3
Re: Type mismatch
Welcome to the forums. 
What is "the control"? What are you using?
-
Aug 2nd, 2007, 11:23 AM
#4
Thread Starter
Member
Re: Type mismatch
I have 4 forms. When I debug, the 4th form has these line "schedway = ways"
it goes there...I am little confuse..
-
Aug 2nd, 2007, 11:26 AM
#5
Re: Type mismatch
 Originally Posted by emmim44
I am little confuse..
So am I.
What control is causing the problem?
Also, in the code that you posted there is no mention or reference to anything that is remotely like "schedway = ways"? Where is that coming from?
-
Aug 2nd, 2007, 11:26 AM
#6
Thread Starter
Member
Re: Type mismatch
When I clicked the change button. it throws that error..There are two text boxes that contaion such data "12:23AM" ...etc...I want to edit the value of the text boxes...when clicks the change button throw the error...I am reading the data from a txt file.
-
Aug 2nd, 2007, 11:29 AM
#7
Re: Type mismatch
Is this the code in the "change" button
Code:
Private Sub Command1_Click()
'ways(routeList.ListIndex).timeOpen = timeConvert(Trim(timeStart.Text))
'ways(routeList.ListIndex).timeClose = timeConvert(Trim(timeEnd.Text))
ways(routeList.ListIndex).timeOpen = Format(Trim(timeStart.Text), "hh:mm AMPM")
ways(routeList.ListIndex).timeClose = Format(Trim(timeStart.Text), "hh:mm AMPM")
target = fillTime(routeList.ListIndex)
End Sub
-
Aug 2nd, 2007, 11:38 AM
#8
Thread Starter
Member
-
Aug 2nd, 2007, 11:59 AM
#9
Re: Type mismatch
Ways is what type of control (textbox, combobox,etc)?
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Aug 2nd, 2007, 12:09 PM
#10
Re: Type mismatch
When you click the button, and the error message pops up, and you click on the Debug button, what line is highlighted?
-
Aug 2nd, 2007, 01:00 PM
#11
Thread Starter
Member
Re: Type mismatch
Type is text box...It takes me here
Private Sub Form_Load()
schedway = ways
For x = 0 To UBound(schedway)
schedway(x).status = x
Next x
target = sortRoute()
haltVar = 1
dayList.ListIndex = 0
target = fillrList()
workList.ListIndex = 0
haltVar = 0
End Sub
-
Aug 2nd, 2007, 01:02 PM
#12
Re: Type mismatch
First, you didn't answer this question
 Originally Posted by Hack
When you click the button, and the error message pops up, and you click on the Debug button, what line is highlighted?
Second, how are these variables declared:
schedway
ways
target
haltVar
-
Aug 2nd, 2007, 01:08 PM
#13
Thread Starter
Member
Re: Type mismatch
Private Type Routes
daysRun(7) As Integer
timeOpen As Integer
timeClose As Integer
status As Integer
name As String
day As Integer
End Type
Dim schedway() As Routes
Dim haltVar As Integer
Dim target As Variant
Dim wsize As Integer
Dim wasize As Integer
Dim r As Integer
Dim p As String
Dim q As String
-
Aug 2nd, 2007, 01:13 PM
#14
Re: Type mismatch
Good. We are making progress. 
Now that I know what the variables are, I should be able to spot your Type Mismatch, but I MUST know on what line the error is occuring. Then I can take a look at what variables are being used against how they have been declared.
So, one more time
 Originally Posted by Hack
When you click the button, and the error message pops up, and you click on the Debug button, what line is highlighted?
-
Aug 2nd, 2007, 01:19 PM
#15
Thread Starter
Member
Re: Type mismatch
The line 2 throws the error
Private Sub Form_Load()
schedway = ways
For x = 0 To UBound(schedway)
schedway(x).status = x
Next x
target = sortRoute()
haltVar = 1
dayList.ListIndex = 0
target = fillrList()
workList.ListIndex = 0
haltVar = 0
End Sub
-
Aug 2nd, 2007, 01:34 PM
#16
Re: Type mismatch
What is 'ways' - I do not see that listed in your other code with the declares.
-
Aug 2nd, 2007, 01:43 PM
#17
Thread Starter
Member
Re: Type mismatch
Now I have defined the ways and workers as
Dim ways() As Long
Dim workers() As Long
it it is giving an error "Invalid qualifier" on line 16...
Code:
Private Sub loadButton_Click()
cd1.DialogTitle = "Load Data"
cd1.Filter = "Text (*.txt)|*.txt|Data (*.dta)|*.dta"
cd1.ShowOpen
Open cd1.FileName For Input As #1
Line Input #1, p
wsize = Val(p)
ReDim Preserve workers(wsize - 1)
Line Input #1, p
wasize = Val(p)
ReDim Preserve ways(wasize - 1)
For x = 0 To wasize - 1
For y = 0 To 6
Line Input #1, q
If q = "Yes" Then
ways(x).daysRun(y) = 1
End If
Next y
Line Input #1, ways(x).name
Line Input #1, p
ways(x).timeOpen = Val(p)
Line Input #1, p
ways(x).timeClose = Val(p)
Next x
For x = 0 To wsize - 1
ReDim workers(x).workDoing(0)
ReDim workers(x).routeKnown(0)
Line Input #1, workers(x).name
For y = 0 To 6
Line Input #1, p
workers(x).workStart(y) = Val(p)
Line Input #1, p
workers(x).workEnd(y) = Val(p)
Line Input #1, p
workers(x).work(y) = Val(p)
Line Input #1, p
workers(x).deadStart(y) = Val(p)
Line Input #1, p
workers(x).deadEnd(y) = Val(p)
Line Input #1, p
workers(x).dead(y) = Val(p)
Next y
Dim putter As String
Dim cntr As Integer
cntr = 1
For z = 0 To wasize - 1
Line Input #1, putter
If putter = "Yes" Then
ReDim Preserve workers(x).routeKnown(cntr)
workers(x).routeKnown(cntr) = ways(z)
cntr = cntr + 1
ElseIf putter = "Train" Then
ReDim Preserve workers(x).routeKnown(cntr)
workers(x).routeKnown(cntr) = ways(z)
workers(x).routeKnown(cntr).status = 0
cntr = cntr + 1
End If
Next z
Line Input #1, q
r = Val(q)
ReDim Preserve workers(x).workDoing(r)
For y = 1 To r
Line Input #1, p
Line Input #1, q
For z = 0 To wasize - 1
If ways(z).name = p Then
workers(x).workDoing(y) = ways(z)
workers(x).workDoing(y).day = Val(q)
End If
Next z
Next y
Next x
Close #1
End Sub
Last edited by Hack; Aug 2nd, 2007 at 01:48 PM.
Reason: Added Code Tags
-
Aug 2nd, 2007, 01:58 PM
#18
Re: Type mismatch
 Originally Posted by Hack
What is 'ways' - I do not see that listed in your other code with the declares.
 Originally Posted by Mark Gambo
Ways is what type of control (textbox, combobox,etc)?
I asked the same thing in Post #9
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Aug 2nd, 2007, 03:15 PM
#19
Thread Starter
Member
-
Aug 2nd, 2007, 03:19 PM
#20
Hyperactive Member
Re: Type mismatch
 Originally Posted by emmim44
I am getting this error while trying to use the control...
"Type mismatch "
The function is:
Private Sub Command1_Click()
'ways(routeList.ListIndex).timeOpen = timeConvert(Trim(timeStart.Text))
'ways(routeList.ListIndex).timeClose = timeConvert(Trim(timeEnd.Text))
ways(routeList.ListIndex).timeOpen = Format(Trim(timeStart.Text), "hh:mm AMPM")
ways(routeList.ListIndex).timeClose = Format(Trim(timeStart.Text), "hh:mm AMPM")
target = fillTime(routeList.ListIndex)
End Sub
===>The error place
schedway = ways
is there supposed to be a ' there?
-
Aug 2nd, 2007, 06:31 PM
#21
Thread Starter
Member
Re: Type mismatch
The commented the ones are the original ones but I was still getting the same error..I need a solution dudes..You are the genius..
-
Aug 2nd, 2007, 11:03 PM
#22
Re: Type mismatch
I'm guessing the problem has to do with this:
Dim ways() As Long
...
ways(x).daysRun(y) = 1
Long variables don't have any properties. They definitely do not have a "daysRun()" array property.
-
Aug 3rd, 2007, 07:50 AM
#23
Thread Starter
Member
Re: Type mismatch
I am sorry in the module.bas These are defined as
Private Type Routes
daysRun(7) As Integer
timeOpen As Integer
timeClose As Integer
status As Integer
name As String
day As Integer
End Type
Private Type driver
name As String
workStart(7) As Integer
workEnd(7) As Integer
work(7) As Integer
dead(7) As Integer
deadStart(7) As Integer
deadEnd(7) As Integer
routeKnown() As Routes
workDoing() As Routes
End Type
Global workers() As driver
Global ways() As Routes
-
Aug 3rd, 2007, 07:55 AM
#24
Thread Starter
Member
Re: Type mismatch
After all.
The error line is 8:::
Function timeConvert(given)
Dim a As Integer
Dim b As Integer
Dim time As String
time = Replace(given, "AM", "")
time = Replace(given, "PM", "")
time = Replace(given, ":", "")
a = time / 100
b = given Mod 60
time = "AM"
If a = 0 Then
a = 12
End If
If a > 12 Then
a = a - 12
time = "PM"
End If
If b < 10 Then
Dim c As String
time = Str(a) + ":" + "0" + Replace(Str(b), " ", "") + time
Else
time = Str(a) + ":" + Replace(Str(b), " ", "") + time
End If
timeConvert = time
End Function
Function routeEqual(given1, given2)
given1.timeOpen = given2.timeOpen
given1.timeClose = given2.timeClose
given1.status = given2.status
given1.name = given2.name
given1.day = given2.day
For x = 0 To 6
given1.daysRun(x) = given2.daysRun(x)
Next x
End Function
-
Aug 3rd, 2007, 12:26 PM
#25
Re: Type mismatch
In a nutshell, what is TimeConvert() supposed to do?
-
Aug 3rd, 2007, 12:58 PM
#26
Thread Starter
Member
Re: Type mismatch
TimeConert the minutes(1680 minutes) format time into a real time format...
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
|