|
-
Sep 27th, 2000, 10:21 AM
#1
Thread Starter
Addicted Member
I keep getting this type mismatch error when I go to update on one of my forms. I have looked up every possible cause in the Help file, but there is nothing explaining my problem or helping with a solution. I also have an error handling trap, but it just comes up with error '-2147352571 Typemismatch. Does anyone have any ideas what could be wrong?
Thanks Aja
-
Sep 27th, 2000, 10:36 AM
#2
On what line do you get the error?
-
Sep 27th, 2000, 10:45 AM
#3
Thread Starter
Addicted Member
It doesn't take me to any line, the error box only has an ok button on it.
-
Sep 27th, 2000, 10:51 AM
#4
After you click OK it should highlight the line with the error for you.
-
Sep 27th, 2000, 10:55 AM
#5
Thread Starter
Addicted Member
I know, but it doesn't do that. The error handling code I use looks like this:
private sub
error goto errorupdate
'code
exitupdate:
exit sub
errorupdate:
msgbox err.number & vbcrlf & err.description, , "error"
resume exitupdate
end sub
Does this error handling look right?
-
Sep 27th, 2000, 10:56 AM
#6
Addicted Member
Are you using controls that are "Binded" to fields in a table...
If so, it's one of control's datafield that is not spelled right... or data is of different type...
[Edited by *Vince on 09-27-2000 at 11:58 AM]
-
Sep 27th, 2000, 10:59 AM
#7
Could you please post this procedure?
-
Sep 27th, 2000, 11:01 AM
#8
Thread Starter
Addicted Member
Private Sub cmdUpdate_Click()
Dim stroldMachineno As String
Dim stroldOperName As String
Dim stroldStartTime As String
Dim stroldEndTime As String
Dim stroldRepairTime As String
Dim stroldSetupTime As String
Dim stroldPMTime As String
Dim stroldPartsDesc As String
Dim stroldComments As String
Dim strMessage As String
Dim strSql As String
Dim fldNo As Field
Dim fldName As Field
Dim fldStart As Field
Dim fldEnd As Field
Dim fldRTime As Field
Dim fldSTime As Field
Dim fldPTime As Field
Dim fldParts As Field
Dim fldComments As Field
On Error GoTo ErrorUpdate
strSql = "Select Machineno, OperName, StartTime, EndTime, RepairTime, SetupTime, PMTime, PartsDesc, Comments From MachineMaintenance"
Set rsMachineMaintenance = New ADODB.Recordset
With rsMachineMaintenance
.Open strSql, cnn, adOpenDynamic, adLockOptimistic
Set fldNo = .Fields("Machineno")
Set fldName = .Fields("OperName")
Set fldStart = .Fields("StartTime")
Set fldEnd = .Fields("EndTime")
Set fldRTime = .Fields("RepairTime")
Set fldSTime = .Fields("StartTime")
Set fldPTime = .Fields("PMTime")
Set fldParts = .Fields("PartsDesc")
Set fldComments = .Fields("Comments")
stroldMachineno = fldNo
stroldOperName = fldName
stroldStartTime = fldStart
stroldEndTime = fldEnd
stroldRepairTime = fldRTime
stroldSetupTime = fldSTime
stroldPMTime = fldPTime
stroldPartsDesc = fldParts
stroldComments = fldComments
fldNo = txtMachineno
fldName = txtOperName
fldStart = txtStartTime
fldEnd = txtEndTime
fldRTime = txtRepairTime
fldSTime = txtSetupTime
fldPTime = txtPMTime
fldParts = txtPartsDesc
fldComments = txtComments
strMessage = "Edit in progress:" & vbCrLf & _
"Original data = " & _
stroldMachineno & " " & stroldOperName & " " & stroldStartTime & " " & stroldEndTime & " " & _
stroldRepairTime & " " & stroldSetupTime & " " & stroldPMTime & " " & stroldPartsDesc & " " & _
stroldComments & _
"Data in buffer = " & _
fldNo & " " & fldName & " " & fldRTime & " " & fldSTime & " " & _
fldPTime & " " & fldParts & " " & fldComments & vbCrLf & vbCrLf & _
"Use Update to replace the original data with " & _
"the buffered data in the Recordset?"
If MsgBox(strMessage, vbYesNo) = vbYes Then
.Update
Else
.CancelUpdate
End If
MsgBox "Data in recordset = " & fldNo & " " & fldName & " " & fldStart & " " & fldEnd & " " & _
fldRTime & " " & fldSTime & " " & fldPTime & " " & fldParts & " " & fldComments
If Not (stroldMachineno = fldNo And stroldOperName = fldName And stroldStartTime = fldStart And _
stroldEndTime = fldEnd And stroldRepairTime = fldRTime And stroldSetupTime = fldSTime And _
stroldPMTime = fldPTime And stroldPartsDesc = fldParts And stroldComments = fldComments) Then
fldNo = stroldMachineno
fldName = stroldOperName
fldStart = stroldStartTime
fldEnd = stroldEndTime
fldRTime = stroldRepairTime
fldSTime = stroldSetupTime
fldPTime = stroldPMTime
fldParts = stroldPartsDesc
fldComments = stroldComments
.Update
End If
.Close
End With
cnn.Close
ExitUpdate:
Exit Sub
ErrorUpdate:
MsgBox Err.Number & vbCrLf & Err.Description, , "Error"
Resume ExitUpdate
End Sub
-
Sep 27th, 2000, 11:16 AM
#9
Ok... I thought the procedure was smaller.
Anyway, remove the On Error line for a moment, run the program, and check in what line the error occurs.
-
Sep 27th, 2000, 11:24 AM
#10
Thread Starter
Addicted Member
The error is on line
fldSTime = txtSetupTime
Sorry about all the code!!!
-
Sep 27th, 2000, 11:35 AM
#11
What type is the field fldSType?
-
Sep 27th, 2000, 12:08 PM
#12
Thread Starter
Addicted Member
fldSTime is dimmed as a field.
txtSetupTime is a integer.
-
Sep 27th, 2000, 12:18 PM
#13
I meant, is the field a text field? A date field? Autonumber?
-
Sep 27th, 2000, 12:28 PM
#14
Thread Starter
Addicted Member
I figured out the problem. The line the error goes to is wrong because I should of had "SetupTime" instead of "StartTime". I'm sorry about all the headaches I probably gave you, but I appreciated you trying to help me out ScOrp!!
Thanks again, Aja
-
Sep 27th, 2000, 12:35 PM
#15
No problem.
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
|